add_forecast_dates {dateutils}R Documentation

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"'

date_name

name of date column

Value

NA-filled data.table in wide format

Examples

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

[Package dateutils version 0.1.5 Index]