-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
63 lines (44 loc) · 1.63 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
results = 'hold',
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
<!-- badges: start -->
[![R-CMD-check](https://github.com/msperlin/GetBCBData/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/msperlin/GetBCBData/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
## Motivation
The Central Bank of Brazil (BCB) offers access to its SGS system (sistema gerenciador de series temporais) with a official API available [here](http://www.bcb.gov.br/?sgs).
Package GetBCBData offers a R interface to the API and many other advantages:
- Use of a caching system with package `memoise` to speed up repeated requests of data;
- User can utilize all cores of the machine (parallel computing) when fetching a large batch of time series;
- Error handling internally. Even if requested series does not exist, the function will still return all results.
## Installation
```{r, eval=FALSE}
# CRAN (official release)
install.packages('GetBCBData')
# Github (dev version)
devtools::install_github('msperlin/GetBCBData')
```
## A simple example
```{r}
library(GetBCBData)
library(ggplot2)
my.id <- c('Selic' = 432)
df.bcb <- gbcbd_get_series(my.id, cache.path = tempdir())
head(df.bcb)
p <- ggplot(df.bcb, aes(x = ref.date, y = value) ) +
geom_line() +
labs(title = 'SELIC',
subtitle = paste0(min(df.bcb$ref.date), ' to ', max(df.bcb$ref.date)),
x = 'Time', y = 'Percentage*100') +
theme_light()
print(p)
```