# load libraries and data
library(readr)
library(dplyr)
library(ggplot2)
options(scipen=10000) #removes scientific notation
noaa_data <- read_csv('carbon_dioxide_levels.csv')
##
## -- Column specification --------------------------------------------------------
## cols(
## Age_yrBP = col_double(),
## CO2_ppmv = col_double()
## )
head(noaa_data)
## # A tibble: 6 x 2
## Age_yrBP CO2_ppmv
## <dbl> <dbl>
## 1 137 280.
## 2 268 275.
## 3 279 278.
## 4 395 279.
## 5 404 282.
## 6 485 278.
#Create NOAA Visualization here:
noaa_viz <- ggplot(data = noaa_data, aes(x = Age_yrBP, y = CO2_ppmv)) +
geom_line() +
labs(title = 'Carbon Dioxide Levels From 8,000 to 136 Years BP', subtitle = 'From World Data Center for Paleoclimatology and NOAA Paleoclimatology', x = 'Years Before Today (0=1950)', y = 'Carbon Dioxide Level (Parts Per Million)') +
scale_x_reverse(lim = c(800000, 0))
noaa_viz

millennia_max = max(noaa_data$CO2_ppmv)
millennia_max
## [1] 298.6
#Create IAC Visualization
iac_data <- read_csv('yearly_co2.csv')
head(iac_data)
## # A tibble: 6 x 4
## year data_mean_global data_mean_nh data_mean_sh
## <dbl> <dbl> <dbl> <dbl>
## 1 0 277. 277. 277.
## 2 1 277. 277. 277.
## 3 2 277. 277. 277.
## 4 3 277. 277. 277.
## 5 4 277. 277. 277.
## 6 5 277. 277. 277.
iac_viz <- ggplot(data = iac_data, aes(x = year, y = data_mean_global)) +
geom_line() +
labs(title = 'Carbon Dioxide Levels over Time', subtitle = 'From Institute for Atmospheric and Climate Science', x = 'Year', y = 'Carbon Dioxide Level (Parts Per Million)') +
geom_hline(aes(yintercept = millennia_max, linetype = 'Historical CO2 Peak before 1950'))
iac_viz
