In this post I introduce my RClimate functions which allow R users to easily download and plot monthly temperature anomaly data for the 5 major global temperature anomaly data series: GISS, HAD, NOAA, RSS, UAH.
Consolidated LOTA Data File
In this previous post I introduced my global Land Ocean Temperature Anomaly (LOTA) monthly csv file that Excel and R users can download to conduct climate trend analysis.
In this post, I introduce my RClimate.txt R scripts that users can source() to simplify access to the LOTA data. Please note that I have used the “.txt” descriptor for my file type to avoid download problems encountered when I use the standard R file descriptor.
You can find my RClimate.txt file here. R users can source() this file to have access to my functions.
So far, I have developed 5 functions to download and process the LOTA data files from the source agency sites, get_lota() function to download the combined 5 series LOTA csv file to a user’s PC, and a which_series() function to plot the monthly data for a user specified data series.
You can use the get_ lota() function to download the LOTA csv file to your PC,
source("http://processtrends.com/Files/RClimate.txt") lota <- get_lota() head(lota) > yr_frac yr_mon GISS HAD NOAA RSS UAH 1 1880.042 188001 -0.41 -0.007 -0.0491 NA NA 2 1880.125 188002 -0.27 -0.250 -0.2258 NA NA 3 1880.208 188003 -0.25 -0.176 -0.2095 NA NA 4 1880.292 188004 -0.31 -0.151 -0.1221 NA NA 5 1880.375 188005 -0.31 -0.245 -0.1279 NA NA 6 1880.458 188006 -0.39 -0.336 -0.1757 NA NA
You can use the which_series(?) function to get a plot of monthly data and 13 month moving average for your target LOTA data series. Note that you simply enter the number for the desired data series, 1=GISS, 2=HAD, 3=NOAA, 4=RSS, 5=UAH. They are numbered alphabetically to make it easier to remember.
Here’s the script and plot for the UAH data series, pretty simple!
which_series(5) > You entered UAH
Functions to Retrieve Data From Climate Agency
Users who would like to retrieve the monthly data directly from the source agencies can use the same functions that I use to build my csv file. My source agency retrieval functions are named func_agency, so NOAA’s function is func_NOAA. Here’s how I retrieve the NOAA data:
NOAA_df <- func_NOAA() head(NOAA_df) > yr_frac yr_mon NOAA 1 1880.042 188001 -0.0491 2 1880.125 188002 -0.2258 3 1880.208 188003 -0.2095 4 1880.292 188004 -0.1221 5 1880.375 188005 -0.1279 6 1880.458 188006 -0.1757