Description Usage Arguments Value Examples
View source: R/ITSModelingCode.R
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'.
1 | add_lagged_covariates(dat, outcomename, covariates = NULL)
|
dat |
The dataframe |
outcomename |
The outcome of interest (string) |
covariates |
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. |
Augmented dataframe with lagged covariates as new columns. Will clobber old columns if the names (of form "lag.XXXX") conflict.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.