# obtain price data in .csv format from https://ember-climate.org/data/carbon-price-viewer/ # 26/02/21 its now https://ember-climate.org/data/carbon-price-viewer/ # Mar 12, 2022, 20:49:26 new data file name "EMBER_Coal2Clean_EUETSPrices.csv" but this is only data from 1 April 2021 # read in price data in .csv format euaprice <- read.csv("eua-price.csv", colClasses = c("Date","numeric")) euaprice2022 <-read.csv("EMBER_Coal2Clean_EUETSPrices.csv",colClasses=c("Date","numeric")) # check the 2 data sets str(euaprice) 'data.frame': 667 obs. of 2 variables: $ Date : Date, format: "2008-04-07" "2008-04-14" ... $ Price: num 25.4 26.2 26.4 25.5 26.5 ... str(euaprice2022) 'data.frame': 309 obs. of 2 variables: $ Date : Date, format: "2021-01-04" "2021-01-05" ... $ Price: num 33.7 33 33.6 34.8 34.9 ... summary(euaprice) Date Price Min. :2008-04-07 Min. : 2.968 1st Qu.:2011-07-28 1st Qu.: 6.216 Median :2014-10-06 Median :10.242 Mean :2014-09-26 Mean :12.922 3rd Qu.:2017-12-14 3rd Qu.:17.089 Max. :2021-02-22 Max. :38.946 summary(euaprice2022) Date Price Min. :2021-01-04 Min. :31.62 1st Qu.:2021-06-09 1st Qu.:52.41 Median :2021-11-11 Median :64.03 Mean :2021-11-12 Mean :65.91 3rd Qu.:2022-04-18 3rd Qu.:82.09 Max. :2022-09-21 Max. :98.01 # the month of March 2021 is missing # combine the two data sets with rbind euaprice20092022 <-rbind(euaprice,euaprice2022) # 22/09/2022 create svg format EUA chart with 12 pt text font and no grid lines svg(filename="EUAprice20092022-720by540.svg", width = 8, height = 6, pointsize = 12, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel")) par(mar=c(2.7,2.7,1,1)+0.1) plot(euaprice20092022,ylim=c(0,99),tck=0.01,ann=TRUE,las=1,col="red",lwd=2,type='l',lty=1) axis(side=4, tck=0.01, las=0,tick=TRUE,labels = FALSE) mtext(side=1,cex=1,line=-1.3,"Data: 'EUA prices' https://ember-climate.org/data/carbon-price-viewer/") mtext(side=3,cex=1.6, line=-2.2,expression(paste("European Union EUA Prices 2008 - 2022")) ) mtext(side=2,cex=1, line=-1.3,"Euro/tonne") mtext(side=4,cex=0.75, line=0.05,R.version.string) dev.off()