Quandl is now available within the R console as a package on CRAN. You now have all the power of the Quandl API directly in your R console.
To get started type
And now just pick your favourite dataset and enter its code.
mydata = Quandl("NSE/OIL")
The most recent version of the Quandl package will always be available on Github first and every few months will be pushed to CRAN. To install the latest version from github enter this code snippet.
install.packages("devtools") library(devtools) install_github('R-package','quandl') library(Quandl)
Current fixes on the most recent version: Better error catching, multisets.
For prolonged use—more than 50 calls a day—you will need to register an account with Quandl to get an authentication token. Go to your account page—after creating an account—and click on the API tab. This token will allow you to make 500 calls per day.
You can request more calls per day by contacting us.
Then after the Quandl library is loaded type this (including the quotes):
Now when you call the Quandl function it will automatically use your authentication token to connect with the Quandl API.
mydata = Quandl("NSE/OIL", start_date="yyyy-mm-dd",end_date="yyyy-mm-dd")
mydata = Quandl("NSE/OIL", collapse="annual")("weekly"|"monthly"|"quarterly"|"annual")
mydata = Quandl("NSE/OIL",transformation="rdiff")("diff"|"rdiff"|"normalize"|"cumulative")
For more information about the API see our API page.
Available Data Types
The Quandl package is able to return data in 4 very usable formats: data frame ("raw"), ts ("ts"), zoo ("zoo") and xts ("xts"). Defaults to "raw".
timeseries = Quandl("NSE/OIL",type = "ts")
You can search Quandl for datasets from within the R consolse. The function is as follows.
Quandl.search(query = "Search Term", page = int, source = "Specific source to search", silent = TRUE|FALSE)
The only mandatory parameter is query.
- Query: Term you wish to search for datasets on Quandl with.
- Page: Which page of search results you wish to return defaults at 1.
- Source: Specific source which you wish to search.
- Silent: Whether you wish the first 3 results to be printed in the console.
A search for Oil, searching only the National Stock Exchange of India (NSE).
Quandl.search("Oil", source = "NSE")
Oil India Limited Code: NSE/OIL Desc: Historical prices for Oil India Limited (OIL), (ISIN: INE274J01014), National Stock Exchange of India. Freq: daily Cols: Date|Open|High|Low|Last|Close|Total Trade Quantity|Turnover (Lacs) Crude Oil (petroleum) Price Code: IMF/POILAPSP_INDEX Desc: Crude Oil (petroleum), Price index, 2005 = 100, simple average of three spot prices; Dated Brent, West Texas Intermediate, and the Dubai Fateh Freq: monthly Cols: Date|Price China Crude Oil Consumption Code: INDEXMUNDI/ENERGY_CHINA_CRUDEOIL Desc: Energy production of Crude Oil in China. Units=Thousand Barrels per Day Freq: annual Cols: Year|Thousand Barrels per Day
If you would like to try the most up to date version of the package, visit our Github page. As always suggestions are more than welcome.
I am not an R expert. Please give suggestions on how I can improve this package.