add_lagged_covariates: Augment dataframe with lagged covariates
Description
Take outcome and a list of covariates and add new columns with lagged
versions. Assumes rows of dataframe are in time ascending order. Lagged
outcome canonically called 'lag.outcome'. Covariates 'lag.XXX'.
The covariates to lag along with the outcome. This can be
either of two things. First, it can be a list of string names. Covariates
can also be a function with a "lags" attribute with the listed covariates
(as returned by, e.g., make_fit_season_model) (which is a list of string
names). NULL if no covariates other than outcome should be lagged.
Value
Augmented dataframe with lagged covariates as new columns. Will
clobber old columns if the names (of form "lag.XXXX") conflict.