fred: Download Federal Reserve Data

Description Usage Arguments Value Examples

View source: R/fred_functions.R

Description

fred downloads data from the Federal Reserve Economic Database (FRED) and formats it to an 'xts' object.

Usage

1
2
fred(..., trans = NULL, form = NULL, freq = NULL, date = NULL,
  opt = NULL, name = NULL, units = NULL)

Arguments

...

vector of FRED codes as strings. If string begins with '?', fredSearch is called to search for the series. The following codes are also accepted: 'gap', 'cyclical', 'inflation', 'Y', 'I', 'G', and 'NX'.

trans

vector of characters used to transform the corresponding series. Calls the trans function. Accepts 'log', 'l', 'g', 'gy', 'd', 'dy', 'dv', 'pdv', 'ldv', 'i', 'r', and 's'.

form

character string. If specified, formula used to combine the FRED series. Similar to the 'formula' field on the FRED website. Each series in ... is assigned a letter (a)-(z) sequentially to be used in the formula.

freq

time frequency to convert with which to convert the series. Accepts 'y', 'q', 'm', 'w', or 'd'.

date

starting and ending period for the series. Uses 'xts' conventions, e.g. '1970-01/1972-10'

opt

additional options passed to trans

name

vector specifying the resulting column names. If NULL, the FRED code is used.

units

units of the resulting object. Appended to the attributes. If NULL, the units from the FRED website are used.

Value

'xts' object

Examples

1
2
3
Y <- fred('GDPC1', trans = 'gy') # yearly growth rate of Real GDP
gap <- fred('GDPC1', 'GDPPOT', form = '(a-b)/b*100', units = 'Percent')
urate <- fred('?unemploy rate')  # evokes search

cmann3/recon documentation built on May 13, 2019, 8:23 p.m.