Get the series from BCB
Usage
get_series(
code,
start_date = NULL,
end_date = NULL,
last = 0,
as = c("tibble", "xts", "ts", "data.frame", "text")
)Arguments
- code
series code
- start_date
series initial date. Accepts ISO character formated date and
Date.- end_date
series final date. Accepts ISO character formated date and
Date.- last
last items of the series
- as
the returning type: data objects (
tibble, xts, data.frame, ts) ortextfor raw JSONcodeargument can be obtained in the SGS system site. In this site searches can be executed in order to find out the desired series and use the series code in thecodeargument.The arguments
start_date,end_dateandlastare optional. If none of these arguments are set, then the entire time series is downloaded. Definestart_dateandend_dateto download a period of data and to download the lastNregisters define thelastargument toNa positive integer. Oncelastis provided it overrides the argumentsstart_dateandend_date.
Value
tibble is the default returning class, but the argument as can be set
to xts, data.frame, ts, or text to return these other types.
text returns the JSON data provided by the remote API.
Examples
# download the entire series
if (FALSE) {
get_series(1)
}
# download a period of dates
if (FALSE) {
get_series(1, start_date = "2016-12-01")
}
if (FALSE) {
x <- get_series(1, start_date = "2016-12-01", end_date = "2016-12-31")
}
# downlaod the last register
if (FALSE) {
x <- get_series(1, last = 1)
}
