add_forecast_dates: Add NA values to the tail of a wide data.table

Description Usage Arguments Value Examples

Description

Add NA values to the tail of a wide data.table to be filled by forecasting routines

Usage

1
2
3
4
5
6
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"'

date_name

name of date column

Value

NA-filled data.table in wide format

Examples

1
add_forecast_dates(fred[series_name == "gdp constant prices"],frq="quarter")

dateutils documentation built on Nov. 10, 2021, 5:09 p.m.