-
-
Save codecademydev/d9bfd309c71715faef92c9498a13600b to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Visualizing Carbon Dioxide Levels" | |
output: html_notebook | |
--- | |
```{r message=FALSE, warning=FALSE, error=TRUE} | |
# load libraries and data | |
library(readr) | |
library(dplyr) | |
library(ggplot2) | |
``` | |
```{r error=TRUE} | |
options(scipen=10000) #removes scientific notation | |
#Create NOAA Visualization here: | |
noaa_data <- read_csv("carbon_dioxide_levels.csv") | |
head(noaa_data) | |
colnames(noaa_data) | |
noaa_viz <- ggplot(noaa_data,aes(x="Age_yrBP",y="CO2_ppmv")) + geom_line()+ labs(title="CarbonDioxide Levels From 8,000 to 136 Years BP",subtitle = "From World Data Center for Paleoclimatology and NOAA Paleoclimatology Program",x="Years Before Today (0=1950)",y="Carbon Dioxide Level (Parts Per Million)") | |
noaa_viz | |
noaa_viz + scale_x_reverse(lim=c(800000,0)) | |
#noaa_viz | |
``` | |
```{r message=FALSE, error=TRUE} | |
#Create IAC Visualization | |
iac_data <- read_csv("yearly_co2.csv") | |
iac_data %>% head() | |
iac_data %>% colnames() | |
iac_viz <- ggplot(data=iac_data,aes(x=year,y=data_mean_global)) + geom_line() + labs(title="Carbondioxide Levels Over Time",subtitle="From Institue for Atmospheric and Climate Science(IAC)",x="Year",y="Carbon Dioxide level(Parts Per Million)") | |
iac_viz | |
millennia_max <- max(noaa_data$CO2_ppmv) | |
millennia_max | |
iac_viz <- iac_viz + geom_hline(aes(yintercept=millennia_max,linetype="Historical CO2 Peak Before 1950")) | |
iac_viz | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment