getDataSeries: Downloading data series

View source: R/CBRT.R

getDataSeriesR Documentation

Downloading data series

Description

Downloads one or more data series from the CBRT datasets.

Usage

getDataSeries(
  series,
  CBRTKey = myCBRTKey,
  freq,
  aggType,
  startDate = "01-01-1950",
  endDate,
  na.rm = TRUE
)

Arguments

series

A vector of data series' codes.

CBRTKey

Your personal CBRT access key.

freq

Numeric, the frequency of the data series. If not defined, the default (the highest possible frequency) will be used. The frequencies are as follows:

1

Day

2

Work day

3

Week

4

Biweekly

5

Month

6

Quarter

7

Six months

8

Year

aggType

Aggregation of data series. This paremeter defines the method to be used to aggregate data series from high frequency to low frequency (for example, weekly data to monthly data). The following methods are available:

avg

Average value

first

First observation

last

Last observation

max

Maximum value

min

Minimum value

sum

Sum

If a frequency level lower than the default is used, the data will be aggregated by using the default method for that data group (for example, if monthly data are download for weekly series).

startDate

The beginning date for data series (DD-MM-YYYY).

endDate

The ending date for data series (DD-MM-YYYY). If not defined, the default (the latest available) will be used.

na.rm

Logical variable to drop all missing dates.

Value

a data.table object

Examples

## Not run: 
mySeries <- getDataSeries("TP.D1TOP")
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB"))
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB", startDate="01-01-2010"))

## End(Not run)


etaymaz/CBRT documentation built on Nov. 17, 2024, 8:34 p.m.