#install.packages("GetBCBData")
#install.packages("xts", repos="http://cloud.r-project.org")
library(GetBCBData)
library(xts)
## Carregando pacotes exigidos: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks xts::first()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::last() masks xts::last()
library(ggplot2)
transacoes = gbcbd_get_series('23461', first.date= '1990-01-01', last.date = '2022-01-01',
format.data = "long", be.quiet = FALSE)[ ,1:2]
##
## Fetching id = 23461 [23461] from BCB-SGS with cache
## Found 27 observations
data = transacoes$ref.date
transacoes[0,1]=NULL
colnames(transacoes) = c('data','transacoes')
transações = xts(transacoes, order.by = data)
ggplot(transacoes)+
geom_point(mapping = aes(x=data, y=transacoes))+
labs(title = 'Título', x = 'Datas', y = 'Transações (Saldo)')
