Anthropgenic C02 emissions are responsible for the contribution made to climate change by industrialised society.
# system ("wget ftp://data.iac.ethz.ch/CMIP6/input4MIPs/UoM/GHGConc/CMIP/mon/atmos/UoM-CMIP-1-1-0/GHGConc/gr3-GMNHSH/v20160701/mole_fraction_of_carbon_dioxide_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-1-0_gr3-GMNHSH_000001-201412.csv")
#system("wget https://gml.noaa.gov/webdata/ccgg/trends/co2/co2_mm_mlo.txt")
ml<-read.table("mlo.txt")[,c(1,2,4)]
ml$date<-dmy(paste(1,ml$V2,ml$V1))
ml<-data.frame(date=ml$date,co2=ml$V4)
library(readr)
co2<- read_csv("mole_fraction_of_carbon_dioxide_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-1-0_gr3-GMNHSH_000001-201412.csv")
co2 %>% separate(datetime,into=c("date","time"), sep=" ") -> co2
co2<-data.frame(date=dmy(co2$date),co2=co2$data_mean_global)
co2 %>% filter(date > dmy("01/01(1700")) -> co2
dygraph(xts(ml$co2,ml$date)) %>% dyRoller(rollPeriod = 1)
Taking the highest and lwest reading within each calendar year.
library(zoo)
ml$year<-year(ml$date)
ml %>% group_by(year) %>% summarise(mean=mean(co2)) ->mly
mly %>% mutate(dif = mean - lag(mean, order_by = year)) ->mly
ggplot(mly,aes(x=year,y=dif)) +geom_line() + geom_smooth()
The calendar year is an arbitrary 12 month period. An alternative approach is to lag the whole data set by twelve months and take the running difference between the reading in any month and the reading 12 months previously.
ml %>% arrange(date) %>% mutate(lag=lag(co2, 12,order_by = date)) %>% mutate(dif=co2-lag) ->mll
ggplot(mll,aes(x=date,y=dif)) +geom_line() + geom_smooth()
dygraph(xts(mll$dif,mll$date)) %>% dyRoller(rollPeriod = 12)
The
library(readr)
d<- read_csv("annual-co2-emissions-per-country(1).csv")
d %>% filter(d$Entity=="World") -> wd
wd<-data.frame(year=wd$Year,co2=wd$`Annual CO2 emissions`)
dygraph(wd) %>% dyRoller(rollPeriod = 1)