################################################################################### # Date: 2014-01-20 # Author: Oliver Elison Timm # Purpose: get the latest global mean temperatures (annual mean) HADCRUT4 # from the official source (annual mean northern and southern hemispheres) # http://www.metoffice.gov.uk/hadobs/hadcrut4/data/current/download.html # and create a plot of the global mean temperatures ################################################################################### ### clean up memory rm(list=ls()) ### download the data first and store ### it in your data directory as hadcrut4ann.txt buffer<-read.table("data/hadcrut4ann.txt") ### HERE IS SOMETHING USEFUL: ### the default column names (if R doesn't find anything useful in the ### data file in the first line that looks like label names it uses ### V1 V2 V3 etc as names) ### we create labels for the columns in the data ### labels<-make.names(c("time","median","conf.lower1", "conf.upper1","conf.lower2","conf.upper2", "conf.lower3","conf.upper3","conf.lower4", "conf.upper4","conf.lower5","conf.upper5")) attr(buffer,which="names")<-labels ### here we check the new names print(names(buffer)) ### here our first plot: time series of the global mean annual mean temperature anomalies plot(buffer$time,buffer$median,typ='l',col=2,lwd=3,xlab='year [C.E.]',ylab='temp. [deg C]',main='HADCRUT4') dev.copy2pdf(file="figures/hadcrut4ann.pdf")