get_ecodata.Rd
Get data for one or more variables from FRED and/or World Bank Data, for given URLs or variable codes. The function will figure out whether the data is available from FRED or World Bank Data.
get_ecodata(
varcodes,
varnames = NULL,
frequency = NULL,
units = NULL,
recessions = FALSE
)
String for vector of strings that identifies the variable codes or URLs for the data.
Optional, string or vector of strings for the variable names. Default is the code given by the source.
Optional, string for what frequency to aggregate to. Valid only for FRED data. This parameter is passed to `fredr::fredr()`. The default is no aggregation. - "d" - Daily - "w" - Weekly - "bw" - Biweekly - "m" - Monthly - "q" - Quarterly - "sa" - Semiannual - "a" - Annual - "wem" - Weekly, ending Monday - "wetu" - Weekly, ending Tuesday - "wew" - Weekly, ending Wednesday - "weth" - Weekly, ending Thursday - "wef" - Weekly, ending Friday - "wesa" - Weekly, ending Saturday - "wesu" - Weekly, ending Sunday - "bwew" - Biweekly, ending Wednesday - "bwem" - Biweekly, ending Monday
Optional, string indicating the data transformation to make when retrieving the data. This parameter is passed to `fredr::fredr()` and is valid only for FRED data. The default is no transformation. - "lin" - Levels (No transformation) - "chg" - Change - "ch1" - Change from 1 year ago - "pch" - Percent change - "pc1" - Percent change from 1 year ago - "pca" - Compounded annual rate of change - "cch" - Continuously compounded rate of change - "cca" - Continuously compounded annual rate of change - "log" - Natural log
Logical for whether or not to include a dummy variable identifying a NBER U.S. Recessions. Default = FALSE.
Data frame time series that includes the date and the variable requested. The data frame will also include all relevant meta data describing the data and citing its source.