BETSget {BETS}R Documentation

Get a complete time series from a BETS database

Description

Extracts a complete time series from either the Central Bank of Brazil (BCB), the Brazilian Institute of Geography and Statistics (IBGE) or the Brazilian Institute of Economics (FGV/IBRE).

Usage

BETSget(code, from = "", to = "", data.frame = FALSE, frequency = NULL)

Arguments

code

A character or an integer. The unique code that references the time series. This code can be obtained by using the search function. More than one code can be provided at once, through a vector. In this case, be careful with the dates, i.e, parameters from and to. They must either be the same length as code, containing the date limits in order, or an isolated date, but nothing in between. See the examples section.

from

A character or a Data object. Starting date of the time series (format YYYY-MM-DD). Can be a vector of dates/characters if the length of the parameter code is greater than 1.

to

A character or a Data object. Ending date of the time series (format YYYY-MM-DD). Can be a vector of dates/characters if the length of the parameter code is greater than 1.

data.frame

A boolean. True if you want the output to be a data frame. True to ts output.

frequency

An integer. The frequency of the time series. It is not needed. It is going to be used only if the metadata for the series is corrupted.

Value

A ts (time series) object containing the desired series.

Note

Due to the significant size of the databases, it could take a while to retrieve the values. However, it shouldn't take more than 90 seconds.

See Also

ts, BETSsearch and seas

Examples


 # Anual series: GDP at constant prices, in R$ (brazilian reais)
 #BETSget(1208)
 
 # International reserves - Cash concept 
 #int.reserves <- get("3543")
 #plot(int.reserves)
 
 # Exchange rate - Free - United States dollar (purchase)
 #us.brl <- get(3691)
 
 # Multiple requests
 # BETSget(code = c(10777,4447),from = "2001-01-01", to = "2016-10-31")
 # BETSget(code = c(10777,4447),from = c("2001-10-31",""),to = c("2016-10-31",""))
 
 # f <- c("2001-10-31","1998-09-01")
 # t <- c("2014-10-31","2015-01-01")
 # BETSget(code = c(10777,4447), from = f, to = t)
 
 # BETSget(code = c(10777,4447),from = "2001-10-31", to = c("2014-10-31","2015-01-01"))
 # BETSget(code = c(10777,4447),from = c("2002-10-31","1997-01-01"), to = "2015-01-01")
 
 

[Package BETS version 0.4.9 Index]