get_Quandl_series: Import data from Quandl API

Description Usage Arguments Details Value Examples

View source: R/fcts.R

Description

Uses the json api from Quandl (<https://www.quandl.com/tools/api>) to import data into an R session. The great benefit from the original Quandl::Quandl is the use of package memoise to cache results, organization of the output dataframe in the tidy/long format and passing different multiple parameters to manipulate series.

Usage

1
2
3
4
get_Quandl_series(id_in, api_key = NULL, first_date = Sys.Date() - 365,
  last_date = Sys.Date(), do_cache = TRUE, order = "asc",
  collapse = "none", transform = "none",
  cache_folder = "quandl_cache")

Arguments

id_in

Character vector of ids to grab data. When using a named vector, the name is used to register the time series. Example: id_in <- c('US GDP' = 'FRED/GDP')

api_key

YOUR api key (get your own at <https://www.quandl.com/sign-up-modal?defaultModal=showSignUp>)

first_date

First date of all requested series as YYYY-MM-DD (default = Sys.date() - 365)

last_date

Last date of all requested series as YYYY-MM-DD (default = Sys.date() - 365)

do_cache

Do cache? TRUE (default) or FALSE. Sets the use of package memoise to cache results from the api

order

How to order the time series data: 'desc' (descending dates, default) or 'asc' (ascending)

collapse

Frequency of time series: 'none' (default), 'daily', 'weekly', 'monthly', 'quarterly', 'annual'

transform

Quandl transformation: 'none', 'diff', 'rdiff', 'rdiff_from', 'cumul', 'normalize'. Details at <https://docs.quandl.com/docs/parameters-2>

cache_folder

Folder where to save memoise cache files

Details

ATTENTION: You'll need a api key in order to use this function. Get one at <https://www.quandl.com/sign-up-modal?defaultModal=showSignUp>.

Value

A dataframe in the long format

Examples

1
2
3
4
5
6
api_key <- 'YOUR_API_KEY_HERE'
id_in <- c('Inflation argentina' = 'RATEINF/INFLATION_ARG')
## Not run: 
 df <- get_Quandl_series(id_in = id_in, api_key = api_key)
 
## End(Not run)

GetQuandlData documentation built on Oct. 30, 2019, 10:29 a.m.