getFRED: FRED data as zoo object

Description Usage Arguments Value Examples

View source: R/getFRED.R

Description

Returns FRED data as zoo object; it relies on the quantmod::getSymbols function but simplifies download and output

Usage

1
2
getFRED(tickers, names, start = "01/01/1666", end = "01/01/1666", time,
  na = TRUE)

Arguments

tickers

character vector of FRED ticker(s)

names

optional character vector of column name(s) for zoo object; default uses 'tickers' vector

start

optional start date for data download; format is 'dd/mm/yyyy'

end

optional end date for data download; format is 'dd/mm/yyyy'

time

optional string to specify start date; options are 'D' (Days), 'W' (Weeks), 'M' (Months), 'Q' (Quarters), 'Y' (Years), or 'YTD' (Year-to-Date), e.g. '3M', '4Q', '5Y', 'YTD'

na

optional boolean to replace NAs with the last observation if set to FALSE

Value

returns a zoo object with the downloaded FRED data

Examples

1
2
3
4
zoo <- getFRED(tickers = c('UNRATE', 'NROU'), names = c('US Unemployment', 'Natural Unemployment'))
zoo <- getFRED(tickers = c('UNRATE', 'NROU'), names = c('US Unemployment', 'Natural Unemployment'), time = '15Y', na = FALSE)
zoo <- getFRED(tickers = c("T10YIE", "T5YIE"), names = c("10Y Breakeven", "5Y Breakeven"), start = '01/01/2015')
zoo <- getFRED(tickers = c("CPIAUCSL", "PCEPILFE"), names = c("CPI", "Core PCE"), start = '01/01/2000', end = '01/01/2018')

kilianreber/chartbookR documentation built on July 19, 2019, 9:48 a.m.