Quandl.com for Time Series Datasets

[This article was first published on Fear and Loathing in Data Science, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you want to dig in with both feet on time series data, then quandl.com is a good choice.  The website claims to have several million datasets all of them available for free download.  It also allows you to upload data to the site with an authentication token.
Well, the site says it is easy to get data from their API directly into R, so let’s have a crack at it.
My source for this code is Quandl itself:  http://www.quandl.com/help/packages/r
> #install the package
> install.packages(“Quandl”)
> library(Quandl)
> #search Quandl for a dataset on new home construction in the US
> Quandl.search(“new home construction”) #default is to display the first 3 results

Construction Employment in New Hampshire
Code: FRED/NHCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

Construction Employment in New Mexico
Code: FRED/NMCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

Construction Employment in New York
Code: FRED/NYCONS
Desc: Thousands of Persons Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

#That sux, so let’s refine the search as there is nothing useful in that output

> Quandl.search(“Housing Units Completed”, source=”FRED”) #added source here and FRED stands for Federal Reserve

New Privately-Owned Housing Units Completed: Total
Code: FRED/COMPUTSA
Desc: Thousands of Units Seasonally Adjusted Annual Rate, 
Freq: monthly
Cols: Date|Value

New Privately-Owned Housing Units Completed: Total
Code: FRED/COMPUTNSA
Desc: Thousands of Units Not Seasonally Adjusted, 
Freq: monthly
Cols: Date|Value

New Privately-Owned Housing Units Completed in the South Census Region
Code: FRED/COMPUSTSA
Desc: Thousands of Units Seasonally Adjusted Annual Rate, 
Freq: monthly
Cols: Date|Value

# I will settle for Units Completed without seasonal adjustment; The dataset code is “FRED/COMPUTNSA”

> Units = Quandl(“FRED/COMPUTSA”) #download the data
> head(Units)
        Date          Value
1  1968-01-01  1257
2  1968-02-01  1174
3  1968-03-01  1323
4  1968-04-01  1328
5  1968-05-01  1367
6  1968-06-01  1184


There you have it.  I plan to explore the Changepoint package in an upcoming blog using this dataset.

To leave a comment for the author, please follow the link and comment on their blog: Fear and Loathing in Data Science.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)