Quandl.com for Time Series Datasets

July 29, 2013
By

(This article was first published on Fear and Loathing in Data Science, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

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)