# Putting Consolidated Global Temperature Data on-line

In this post I describe an R script that retrieves monthly global temperature anomaly data from 5 sources and consolidates the data into a single CSV file. I then post the consolidated file in an on-line  Google spreadsheet so that users can download the data and conduct their own global temperature trend analysis.

Global Climate Trends

There are many blogs and web sites (small sample: 1, 2, 3, 4, 5, 6) with multiple opinions on global climate trends. Some sites are data oriented and others are opinion oriented. What is a charter to think?

My advice, take a look at the data for yourself. As an Excel or R charter, why not analyze it yourself to get a better appreciation for what is going on.

Here’s the link to my Google spreadsheet of the monthly data. I’ve  tried to simply download and consolidate the raw data as provided by the source sites. My goal is to present the data in a simple CSV format so that Excel, R and other software charters can evaluate the trends without having to struggle through the  source data re-formatting process.

R Script

The source files are a little messy from a charting standpoint, each needs its own reformat procedure. I’ve posted my R script at this link.

Update

Peter Gallagher submitted a comment adding a ggplot2 script for the test plot I made at the end of my R script. Since it took me way to long to get the basic data handling done, I was burned out and just put together an ugly chart of the 5 data series to make sure the data transfer worked.

Peter’s ggplot2 snipet is just great. Thanks Peter! Here’s what it looks like.

### 15 Responses to Putting Consolidated Global Temperature Data on-line

1. Your google data were a handy set against which to test the new, public Eureqa equation generator (http://ccsl.mae.cornell.edu/eureqa).

Given the liberty to use cosines and sines in equations it generates, Eureqa predicted the NOAA data moderately well (I converted the dates to months numbered from 0 (Jan 1979) through 365 (June 2009).

0.0861564 + 0.00136793*Month – 0.0650757*sin(-0.140588*Month)

R^2 on this rising sine curve was 0.691

Anyway

2. RJames

This will be excellent. I already plot some of these, but having access to all five will be very helpful. I haven’t tested it yet. Hope it’s easy to do.

3. from Peru

How could I put those .txt data into an EXCEL table?

PD: Excuse me for the “ffffff”. I was just ckecking that you can actually receive my post.

• Kelly

2. Choose Export – this will give you 6 choices, including csv, txt, and xls

4. Nice work with the Tableau visualization Joe.

5. Hi Kelly,

Many thanks for this. A very useful piece of work (the R script, especially).

I’ve found the best way to use the data downloaded is to add a few lines to the bottom of the script in place of the current ‘test’ plot:

# convert from wide to long format
myDat<-melt(consol_lo, id="yr")
# display in a faceted grid with variable scales for each facet
qplot(yr, value, data=myDat, geom="line", group=variable) + facet_grid(variable ~ ., scale = "free_y")

• Kelly

Peter

Thanks for the ggplot2 check plot script. I tried it and agree that it is much better than my version, so I’ve updated my R script with your version.

6. Hey this is awesome! Thanks!

7. Thank you for putting together a great data set.

Here is my first pass at visualizing the data, an interactive dashboard in Tableau:
http://joemako.com/files/Global_Temperature_Data.twbx

You can select or shift-select the measure names, drag the slider and slider ends, or type in the date range.

or here is a screen capture of it:
http://joemako.com/files/Global_Temperature_Data.png

• Kelly

Joe

Thanks for taking the time to make your chart. I’ll be adding more climate data via Google docs, so I look forward to your contributions.

• Kelly,

I look forward to visualizing any other data you have in store to share. In the mean time, I added the ability to filter the metrics in addition to highlighting, so both filtering and highlighting can be done at the same time.

In other to do this in Tableau, I used Lyza, http://lyzasoft.com, to reshape your provided data set by appending the different metrics as additional rows instead of all values on the same row for each month.

Packed workbook:
http://joemako.com/files/Global_Temperature_Data_v2.twbx

8. Michael

This is a great idea! Unfortunately, the Google Spreadsheet won’t open without permissions. Is this intentional or did you mean to make it a publicly accessible spreadsheet?

• Kelly

Michael

Sorry – I wanted it publicly available. I’ve fixed.

Please let me know if you have any problem accessing the Google doc.