https://github.com/enricoschumann/snbdata
Download datasets from the SNB https://www.snb.ch
https://github.com/enricoschumann/snbdata
central-bank r r-package
Last synced: 3 months ago
JSON representation
Download datasets from the SNB https://www.snb.ch
- Host: GitHub
- URL: https://github.com/enricoschumann/snbdata
- Owner: enricoschumann
- Created: 2023-08-31T10:26:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-13T08:09:39.000Z (over 1 year ago)
- Last Synced: 2023-12-13T09:39:37.082Z (over 1 year ago)
- Topics: central-bank, r, r-package
- Language: R
- Homepage: http://enricoschumann.net/R/packages/SNBdata/index.htm
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
Awesome Lists containing this project
README
# SNBdata
Functions for downloading data from the Swiss National Bank
(SNB; ), the Swiss central bank. The
package is lightweight and comes with few 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.## Installation
To install the development version of the package from a
running R session, type:install.packages('SNBdata',
repos = c('http://enricoschumann.net/R',
getOption('repos')))or clone/build the git repository's latest version.
## Examples
(Examples require an internet connection.)
Start by setting the directory for storing the files.
This is only an example: Much better is to use a permanent
storage-location, such as '~/Downloads/SNBdata'data.dir <- tempdir()
Now fetch data:
rates <- fetch_data("rendoblim",
type = "table",
dest.dir = data.dir,
language = "en")Have data transformed into time-series:
rates <- fetch_data("rendoblim",
type = "table",
dest.dir = data.dir,
language = "en",
time.series = TRUE)Information about identifiers/codes:
if (!is.null(rates)) ## check: if download failed, results
## are NULL
attr(rates, "info")Another example:
stock.markets <- fetch_data("capchstocki",
type = "table",
dest.dir = data.dir,
time.series = TRUE)
## e.g.: stock.markets[, "GDR"] ## total return index