View source: R/step_lag_difference.R
step_lag_difference | R Documentation |
step_lag_difference()
creates a specification of a recipe step
that will generate one or more new columns of derived data.
step_lag_difference(
recipe,
...,
role = "predictor",
horizon = 7,
prefix = "lag_diff_",
skip = FALSE,
id = rand_id("lag_diff")
)
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose variables
for this step. See |
role |
For model terms created by this step, what analysis role should
they be assigned? |
horizon |
Scalar or vector. Time period(s) over which to calculate differences. |
prefix |
A character string that will be prefixed to the new column. |
skip |
A logical. Should the step be skipped when the
recipe is baked by |
id |
A unique identifier for the step |
An updated version of recipe
with the new step added to the
sequence of any existing operations.
Other row operation steps:
step_adjust_latency()
,
step_epi_lag()
,
step_growth_rate()
r <- epi_recipe(covid_case_death_rates) %>%
step_lag_difference(case_rate, death_rate, horizon = c(7, 14)) %>%
step_epi_naomit()
r
r %>%
prep(covid_case_death_rates) %>%
bake(new_data = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.