add_forecast_dates: Add NA values to the tail of a wide data.table
Description
Add NA values to the tail of a wide data.table to be filled by forecasting routines
Usage
add_forecast_dates(
dt,
horizon = 1,
frq = c("month", "week", "quarter", "year"),
date_name = "ref_date"
)Arguments
dt
data.table in wide format
horizon
number of periods to add at specified `frq`
frq
frequency for aggregation, one of `"month"`, `"week"`, `"quarter"`, or `"year"`
Value
NA-filled data.table in wide format
Examples
Run this code# NOT RUN {
add_forecast_dates(fred[series_name == "gdp constant prices"],frq="quarter")
# }
Run the code above in your browser using DataLab