The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The BIS
package provides an R
interface to
data hosted by the Bank for International
Settlements, specifically the single-file
data sets available on the BIS homepage.
You can install the package from CRAN or GitHub.
To start using the package, load it into your R session.
Next, retrieve a list of available data sets using the
get_datasets()
function.
The get_datasets()
function returns a tibble data frame listing
available data sets. Use the url
column as input for the
get_bis()
function to download, parse, and import the
corresponding data set.
For example, to import monthly-frequency data on central banks’ policy rates, use the following code:
To plot the data with ggplot2, run the following:
library("dplyr")
library("ggplot2")
library("zoo")
rates_plot <- subset(rates, ref_area %in% c("US", "XM", "JP", "GB", "CH", "CA"))
rates_plot <- subset(rates, ref_area %in% c("US: United States",
"XM: Euro area",
"JP: Japan",
"GB: United Kingdom",
"CH: Switzerland",
"CA: Canada"))
rates_plot <- mutate(rates_plot, time_period =
as.Date(as.yearmon(time_period, format = "%Y-%m")))
ggplot(rates_plot, aes(time_period, obs_value, color = ref_area)) +
geom_line(show.legend = FALSE) +
facet_wrap(~ref_area) +
labs(title = "Central bank policy rates",
subtitle = "% per annum", x = NULL, y = NULL)
Note that BIS data sets use various time formats. The zoo package (e.g.,
as.yearmon()
) can handle most of these formats.
In some cases, the BIS homepage may only be accessible through a web
browser, preventing the programmatic retrieval of data sets directly
within R. When this occurs, users can manually download the files and
use the read_bis()
function to parse them.
To read a locally stored CSV file, use the following code:
To read a locally stored ZIP file, use this code:
To retrieve individual data series instead of full data sets,
consider using the BIS SDMX RESTful API. The rsdmx R package
supports processing SDMX data in R. The latest development version of
rsdmx
includes a BIS connector to streamline the
process.
This package is neither officially related to nor endorsed by the Bank for International Settlements. It is based on a fork of CC0-licensed code by expersso. Please avoid overloading the BIS servers with unnecessary requests.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.