Title: | Imports Datasets from BCB (Central Bank of Brazil) using Its Official API |
---|---|
Description: | Downloads and organizes datasets using BCB's API <https://www.bcb.gov.br/>. Offers options for caching with the 'memoise' package and , multicore/multisession with 'furrr' and format of output data (long/wide). |
Authors: | Marcelo Perlin [aut, cre] |
Maintainer: | Marcelo Perlin <[email protected]> |
License: | GPL-2 |
Version: | 0.7.0 |
Built: | 2024-11-22 03:05:48 UTC |
Source: | https://github.com/msperlin/getbcbdata |
Using BCB's oficial API at <https://www.bcb.gov.br/>, this function will download data for a specific set of ids and dates. The main advantage is the use of caching and parallel computing for fast operations. You can search for available series at <http://www.bcb.gov.br/?sgs>
gbcbd_get_series( id, first.date = Sys.Date() - 10 * 365, last.date = Sys.Date(), format.data = "long", be.quiet = FALSE, use.memoise = TRUE, cache.path = gbcbd_get_default_cache_folder(), do.parallel = FALSE )
gbcbd_get_series( id, first.date = Sys.Date() - 10 * 365, last.date = Sys.Date(), format.data = "long", be.quiet = FALSE, use.memoise = TRUE, cache.path = gbcbd_get_default_cache_folder(), do.parallel = FALSE )
id |
Id of time series. The name of the vector sets the name of the series in the output (e.g i.d <- c('SELIC' = 11)). You can search for ids in the official BCB-SGS webpage <http://www.bcb.gov.br/?sgs> |
first.date |
First date of time series |
last.date |
Last date of time series |
format.data |
The format of the datasets - long (default, series incremented by rows) or wide (series incremented by columns) |
be.quiet |
Logical. Should functions output messages to screen? - FALSE (default) or TRUE |
use.memoise |
Logical. Sets the use of caching system - TRUE (default) or FALSE |
cache.path |
Path to save cache files - 'rbcb2_cache' (default) |
do.parallel |
Logical for parallel data importation - FALSE (default) |
A dataframe with requested datasets
my.id <- c('Taxa de juros - Selic' = 11) df <- gbcbd_get_series(my.id, cache.path = tempdir())
my.id <- c('Taxa de juros - Selic' = 11) df <- gbcbd_get_series(my.id, cache.path = tempdir())