FRED transformation and subset helper
Apply transformations given by FRED-MD or FRED-QD and generate rectangular
subsets. See fred_qd
for information on data and the Details
section for information on the transformations. Call without arguments to
retrieve available codes / all FRED suggestions.
fred_transform( data, type = c("fred_qd", "fred_md"), codes, na.rm = TRUE, lag = 1L, scale = 100 ) fred_code(vars, type = c("fred_qd", "fred_md"), table = FALSE)
data |
A |
type |
Character scalar. Whether data stems from the FRED-QD or the FRED-MD database. |
codes |
Integer vector. Transformation code(s) to apply to data. Overrides automatic lookup of transformation codes. |
na.rm |
Logical scalar. Whether to subset to rows without any
|
lag |
Integer scalar. Number of lags to apply when taking differences.
See |
scale |
Numeric scalar. Scaling to apply to log differences. |
vars |
Character vector. Names of the variables to look for. |
table |
Logical scalar. Whether to return a table of matching transformation codes instead of just the codes. |
FRED-QD and FRED-MD include a transformation code for every variable. All
codes are provided in system.file("fred_trans.csv", package = "BVAR")
.
The transformation codes are as follows:
1
- no transformation;
2
- first differences - Delta x;
3
- second differences - Delta2 x;
4
- log transformation - log x;
5
- log differences -
Delta log x;
6
- log second differences -
Delta2 log x;
7
- percent change differences -
Delta x / lag-x - 1;
Note that the transformation codes of FRED-MD and FRED-QD may differ for the same series.
fred_transform
returns a data.frame
object with
applied transformations. fred_code
returns transformation
codes, or a data.frame
of matching transformation codes.
# Transform a subset of FRED-QD fred_transform(fred_qd[, c("GDPC1", "INDPRO", "FEDFUNDS")]) # Get info on transformation codes for unemployment variables fred_code("UNRATE", table = TRUE) # Get the transformation code for GDPC1 fred_code("GDPC1", type = "fred_qd") # Transform all of FRED-MD ## Not run: fred_transform(fred_md, type = "fred_md") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.