RClimate Tools for Do It Yourself Climate Trend Analysis

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.

RClimate Functions

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,

lota <- get_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!

> 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()
>  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

One response to “RClimate Tools for Do It Yourself Climate Trend Analysis

  1. ha, glad to see another person using R.

    Drop on over if you like and take code if you like:
    for your annual averages, sometimes you will get data for partial years.
    in that case the following can give you the option to either retain the partial year or not


    if(months<12)stop("data is less than 12 months")
    wholeYears <- floor(months/12)
    excessMonths <- months-(12*wholeYears)
    yearIndex 0)yearIndex<-c(yearIndex,rep(wholeYears+1,excessMonths))
    if(partialYear==TRUE)return(as.vector(annual[,2])) else return(as.vector(annual[1:wholeYears,2]))



    If you want to help by testing code ( pre release code from Forge ) or adding graphics just drop me a line

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s