Description Usage Arguments Details References Examples
Useful tools to work with time series data retrieved from Samizdata provider. The function allows to easily retrieve and transform time series data from a variety of official sources.
It returns a data frame with two lists: date(date)
and ts_name
(obs.).
1 | getSamiz(src, ts_name, vintage='today', country='all', transformation='raw')
|
src |
The source of the time series you want to download (e.g. "FRED","OECD", etc.) |
ts_name |
The name of the time series. |
vintage |
It allows to choose the version of a time series as of a specific point in time. Possible values are valid YYYY-MM-DD dates. The default value is today's date. |
country |
For some sources the country is needed in the ISO country code format (e.g. "IT","US"). |
transformation |
It allows to apply mathematical transformations to time series values before downloading them. If no transformation is specified, then the values are the original ones (RAW). The possible values for the parameter 'transformation' are: RAW: default LOG: the base-10 log of the values LAG: x[t]-x[t-1] LAG2: x[t]-x[t-2] LAGLOG: LOG(x[t])-LOG(x[t-1]) LAG2LOG: LOG(x[t])-LOG(x[t-2]) LAG12LOG: LOG(x[t])-LOG(x[t-12]) SW: LOG(x[t] - 2*LOG(x[t-1])+LOG(x[t-2]) LAG12LAGLOG: LOG(x[t])-LOG(x[t-12])-LOG(x[t-1])-LOG(x[t-13]) |
The function
getSamiz
allows to download data directly from the Samizdata provider.
The values for the source
, ts_name
, country
, transformation
are case-insensitive.
http://www.samizdata.it/api_doc.html#R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | require('stats','samizdata')
# download from the source 'fred' the time series 'gdp'
x <- getSamiz("fred", "gdp")
# download from the source 'fred' the time series 'gdp' at the vintage date '2015-07-01'
x <- getSamiz("fred", "gdp", vintage="2015-07-01")
# download from the source 'worldbank' the time series 'ic.tax.totl.cp.zs',
# for the country Albania 'AL', with the transformation 'log'
x <- getSamiz("worldbank", "ic.tax.totl.cp.zs", country="AL", transformation="log")
# download from the source 'ecb' the time series 'gst_a_fi_n_b0x13_m8v_b1300_sa_e'
# at the transformation 'log'
x <- getSamiz("ecb", "gst_a_fi_n_b0x13_m8v_b1300_sa_e", transformation="log")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.