Title: | Programmatic Access to the European Central Bank's Statistical Data Warehouse |
---|---|
Description: | Provides an interface to the 'European Central Bank's Statistical Data Warehouse' API <https://sdw.ecb.europa.eu/>, allowing for programmatic retrieval of a vast quantity of statistical data. |
Authors: | Eric Persson [aut, cre] |
Maintainer: | Eric Persson <[email protected]> |
License: | CC0 |
Version: | 0.4.2 |
Built: | 2024-11-14 03:43:52 UTC |
Source: | https://github.com/cran/ecb |
Format date variable retrieved from the SDW into a proper date variable
convert_dates(x)
convert_dates(x)
x |
A vector of dates |
A date-formatted vector
hicp <- get_data("ICP.M.U2.N.000000.4.ANR") hicp$obstime <- convert_dates(hicp$obstime) str(hicp)
hicp <- get_data("ICP.M.U2.N.000000.4.ANR") hicp$obstime <- convert_dates(hicp$obstime) str(hicp)
Retrieve data from the ECB Statistical Data Warehouse API
get_data(key, filter = NULL, ...)
get_data(key, filter = NULL, ...)
key |
A character string identifying the series to be retrieved |
filter |
A named list with additional filters (see |
... |
Arguments passed to GET (e.g. timeout(10) to add maximum request time) |
The filter
option of get_data()
takes a named list of key-value pairs.
If left blank, it returns all data for the current version.
Available filter parameters:
startPeriod
& endPeriod
YYYY
for annual data (e.g.: 2013)
YYYY-S[1-2]
for semi-annual data (e.g.: 2013-S1)
YYYY-Q[1-4]
for quarterly data (e.g.: 2013-Q1)
YYYY-MM
for monthly data (e.g.: 2013-01)
YYYY-W[01-53]
for weekly data (e.g.: 2013-W01)
YYYY-MM-DD
for daily data (e.g.: 2013-01-01)
updatedAfter
A timestamp to retrieve the latest version of changed values in the database since a certain point in time
Example: filter = list(updatedAfter = 2009-05-15T14:15:00+01:00)
firstNObservations
& lastNObservations
Example: filter = list(firstNObservations = 12)
retrieves the first 12 observations of all specified series
detail
Possible options: full/dataonly/serieskeysonly/nodata
dataonly
is the default
Use serieskeysonly
or nodata
to list series that match a certain query, without returning the actual data
An alternative to using serieskeys/nodata
is the convenience function get_dimensions()
, which returns a list of dataframes with dimensions and explanations (see extended example below).
full
returns both the series values and all metadata. This entails retrieving much more data than with the 'dataonly' option.
includeHistory
(not currently implemented)
false
(default) returns only version currently in production
true
returns version currently in production, as well as all previous versions
See the SDW API for more details.
A data frame
# Get monthly data on annualized euro area headline HICP hicp <- get_data("ICP.M.U2.N.000000.4.ANR") head(hicp)
# Get monthly data on annualized euro area headline HICP hicp <- get_data("ICP.M.U2.N.000000.4.ANR") head(hicp)
Retrieve data frame of all datasets in the ECB Statistical Data Warehouse
get_dataflows(...)
get_dataflows(...)
... |
Arguments passed to GET (e.g. timeout(10) to add maximum request time) |
A dataframe
df <- get_dataflows() head(df)
df <- get_dataflows() head(df)
Get full, human-readable description of a series
get_description(key)
get_description(key)
key |
A character string identifying the series to be retrieved |
A character vector
get_description("ICP.M.DE.N.000000+XEF000.4.ANR")
get_description("ICP.M.DE.N.000000+XEF000.4.ANR")
Retrieve dimensions of series in the ECB's SDW
get_dimensions(key, ...)
get_dimensions(key, ...)
key |
A character string identifying the series to be retrieved |
... |
Arguments passed to GET (e.g. timeout(10) to add maximum request time) |
A list of data frames, one for each series retrieved
hicp_dims <- get_dimensions("ICP.M.U2.N.000000.4.ANR") hicp_dims[[1]]
hicp_dims <- get_dimensions("ICP.M.U2.N.000000.4.ANR") hicp_dims[[1]]