INSTALLATION & AUTHENTICATION
INSTALLATION
You can download the Quandl R package from CRAN or from GitHub. Follow the installation instructions below.
A package is a collection of functions, data and documentation that extends R's basic functionality.
To install and load the Quandl R package from CRAN:
install.packages("Quandl")
library(Quandl)
To install the Quandl R package from GitHub using devtools:
install.packages("devtools")
library(devtools)
install_github("quandl/quandl-r")
library(Quandl)
AUTHENTICATION
The Quandl R package is free. If you would like to make more than 50 calls a day, however, you will need to create a free Quandl account and set your API key.
Similarly, you must set your API key to download the premium datasets to which you are subscribed.
To make full use of the package, set your API key as follows:
- Create or sign into your account here.
- Input your API key (with quotation marks) into the console:
Quandl.api_key("YOURAPIKEY")
.
Formats and types
Return types
The supported return types for the Quandl()
function are:
- raw (which returns a dataframe)
- ts
- zoo
- xts
- timeSeries
To request a specific type, assign the type argument and the return type.
For example: data <- Quandl('NSE/OIL', type = "xts")
Date formats
zoo, xts, and ts have their own time-series date formats.
For example: data <- Quandl('NSE/OIL', collapse = "quarterly", type = "zoo", limit = 3)
data
will have indexes 2016 Q3
, 2016 Q4
, and 2017 Q1
:
Open | High | Low | |
---|---|---|---|
2016 Q3 | 459.8 | 462.8 | 452.45 |
2016 Q4 | 448.0 | 451.7 | 445.10 |
2017 Q1 | 456.0 | 465.0 | 454.15 |
NOTE: For conciseness, only three data columns appear in the above example response.
Updated about 7 years ago