A function to create 1 through n lags of a set of variables. Is used as a data preparation helper function and is called internally by forecast_univariate, forecast_multivariate, and forecast_combine.

n.lag(Data, lags, variables = NULL)

Arguments

Data

data.frame: data frame of variables to lag and a 'date' column

lags

int: number of lags to create

variables

string: vector of variable names to lag, default is all non-date variables

Value

data.frame