Title: | Download Data from Bundesbank |
---|---|
Description: | Download data from the time-series databases of the Bundesbank, the German central bank. See the overview at the Bundesbank website (<https://www.bundesbank.de/en/statistics/time-series-databases>) for available series. The package provides only a single function, getSeries(), which supports both traditional and real-time datasets; it will also download meta data if available. Downloaded data can automatically be arranged in various formats, such as data frames or 'zoo' series. The data may optionally be cached, so as to avoid repeated downloads of the same series. |
Authors: | Enrico Schumann [aut, cre] |
Maintainer: | Enrico Schumann <[email protected]> |
License: | GPL-3 |
Version: | 0.1-12 |
Built: | 2025-01-14 03:50:55 UTC |
Source: | https://github.com/enricoschumann/bundesbank |
Download time-series from the website of the Bundesbank.
getSeries(series, start = NULL, end = format(Sys.Date(), "%Y-%m"), return.class = "data.frame", verbose = TRUE, dest.dir = NULL, column1.only = TRUE)
getSeries(series, start = NULL, end = format(Sys.Date(), "%Y-%m"), return.class = "data.frame", verbose = TRUE, dest.dir = NULL, column1.only = TRUE)
series |
The series name as given by the Bundesbank (e.g. ‘BBK01.ST0316’ for 3-Month EURIBOR). |
start |
character in format ‘YYYY-MM’ or ‘YYYY’. If omitted, the function downloads data from the earliest available date. Currently ignored for real-time datasets. |
end |
character in format ‘YYYY.MM’ or ‘YYYY’. If omitted, the function downloads data up to the most recent available date. Currently ignored for real-time datasets. |
return.class |
character or |
verbose |
logical |
dest.dir |
|
column1.only |
|
The data can be downloaded in CSV-format from the Bundesbank's website https://www.bundesbank.de/en/statistics/time-series-databases .
If dest.dir
is provided, the downloaded
dataset gets a date prefix (today in format
YYYYMMDD
) and is stored in directory
dest.dir
. Before any download is attempted,
the function checks whether a file with today's
prefix exist in dest.dir
; if yes, the file is
used.
A data.frame with two (or more) columns:
dates |
dates (of class |
values |
numerical values |
The result for single time-series may have an
attribute info
, which is a character vector
and holds additional information for series
(such as its unit). See Examples.
Real-time datasets are always organised as a
data.frame
,
in which the rows correspond to the reporting period
and the columns to the publication date.
Real-time datasets always have several attributes,
in particular date
, which corresponds to the
publication date.
If a download files, the function will print the error
message, but evaluate to NULL
(invisibly).
Maintainer: Enrico Schumann <[email protected]>
## (Internet connection required) series <- "BBK01.ST0304" ## Eonia res <- getSeries(series) ## retrieve all available data res <- getSeries(series, start = "2012-01") res <- getSeries(series, end = "2012-01") res <- getSeries(series, start = "2012-01", end = "2012-05") ## If the download fails, 'res' will be NULL. ## This typically happens when the website of the ## Bundesbank is not available. if (!is.null(res)) { ## make 'zoo' series if (require("zoo")) { Eonia <- zoo(res$values, res$dates) plot(Eonia) } ## check comments writeLines(strwrap(paste("- ", attr(res, "info")), width = 60, exdent = 2)) ## real-time dataset (Gross domestic product) gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A") ## use caching ## ==> the example uses a temporary directory, but ## better is to use a less ephemeral destination, ## e.g. '~/Downloads/bundesbank' gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A", dest.dir = tempdir()) ### Downloading data from Bundesbank ... Done. gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A", dest.dir = tempdir()) ### Using cache ... Done. }
## (Internet connection required) series <- "BBK01.ST0304" ## Eonia res <- getSeries(series) ## retrieve all available data res <- getSeries(series, start = "2012-01") res <- getSeries(series, end = "2012-01") res <- getSeries(series, start = "2012-01", end = "2012-05") ## If the download fails, 'res' will be NULL. ## This typically happens when the website of the ## Bundesbank is not available. if (!is.null(res)) { ## make 'zoo' series if (require("zoo")) { Eonia <- zoo(res$values, res$dates) plot(Eonia) } ## check comments writeLines(strwrap(paste("- ", attr(res, "info")), width = 60, exdent = 2)) ## real-time dataset (Gross domestic product) gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A") ## use caching ## ==> the example uses a temporary directory, but ## better is to use a less ephemeral destination, ## e.g. '~/Downloads/bundesbank' gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A", dest.dir = tempdir()) ### Downloading data from Bundesbank ... Done. gdp <- getSeries("BBKRT.A.DE.N.A.AG1.CA010.V.A", dest.dir = tempdir()) ### Using cache ... Done. }