Title: | Download Data from the Bank for International Settlements (BIS) |
---|---|
Description: | Functions for downloading data from the Bank for International Settlements (BIS; <https://www.bis.org/>) in Basel. Supported are only full datasets in (typically) CSV format. The package is lightweight and without dependencies; suggested packages are used only if data is to be transformed into particular data structures, for instance into 'zoo' objects. Downloaded data can optionally be cached, to avoid repeated downloads of the same files. |
Authors: | Enrico Schumann [aut, cre] |
Maintainer: | Enrico Schumann <[email protected]> |
License: | GPL-3 |
Version: | 0.3-0 |
Built: | 2025-01-19 05:32:42 UTC |
Source: | https://github.com/enricoschumann/bisdata |
Download datasets from the Bank for International Settlements (BIS) and convert to data frames.
fetch_dataset(dest.dir, dataset, bis.url = "https://data.bis.org/static/bulk/", exdir = tempdir(), return.class = NULL, frequency = NULL, ..., header = TRUE, sep = ",", stringsAsFactors = FALSE, check.names = FALSE, na.strings = "", quote = "\"", fill = TRUE) datasets(url = "https://data.bis.org/bulkdownload", ...)
fetch_dataset(dest.dir, dataset, bis.url = "https://data.bis.org/static/bulk/", exdir = tempdir(), return.class = NULL, frequency = NULL, ..., header = TRUE, sep = ",", stringsAsFactors = FALSE, check.names = FALSE, na.strings = "", quote = "\"", fill = TRUE) datasets(url = "https://data.bis.org/bulkdownload", ...)
dest.dir |
file path: where to store the files? |
dataset |
the name of the file |
bis.url |
the base url |
url |
the url from which to fetch information about the datasets |
exdir |
file path: where to unzip? |
return.class |
|
frequency |
string, or nothing ( |
... |
passed on to |
header , sep , stringsAsFactors , check.names , na.strings , quote , fill
|
passed on to |
Supported are full datasets (typically) in CSV format. Downloaded data can optionally be cached, to avoid repeated downloads of the same files.
The default download fetches the data and puts them into
a data.frame
. If return.class
is
not NULL
, fetch_dataset
selects/transforms
data; but this is only supported for few datasets.
If the download fails with an error, then both
functions will return NULL
. For
fetch_dataset
, if the download failed with a
warning from download.file
, then the
function will evaluate to the return value of
download.file
.
typically a data.frame
.
bis_datasets
returns a data.frame
with three columns:
filename |
the dataset filename |
description |
a brief description of the dataset |
updated |
if available, the date when the dataset was last updated |
Enrico Schumann
## (Internet connection required) datasets() bis.data <- fetch_dataset(dest.dir = tempdir(), "WS_CBPOL_csv_col.zip")
## (Internet connection required) datasets() bis.data <- fetch_dataset(dest.dir = tempdir(), "WS_CBPOL_csv_col.zip")