epi_recipe | R Documentation |
A recipe is a description of the steps to be applied to a data set in
order to prepare it for data analysis. This is a loose wrapper
around recipes::recipe()
to properly handle the additional
columns present in an epi_df
epi_recipe(x, ...)
## S3 method for class 'epi_df'
epi_recipe(
x,
reference_date = NULL,
formula = NULL,
...,
vars = NULL,
roles = NULL
)
## S3 method for class 'formula'
epi_recipe(formula, data, reference_date = NULL, ...)
x , data |
An epi_df of the template data set (see below). |
... |
Further arguments passed to or from other methods (not currently used). |
reference_date |
Either a date of the same class as the |
formula |
A model formula. No in-line functions should be used here
(e.g. |
vars |
A character string of column names corresponding to variables that will be used in any context (see below) |
roles |
A character string (the same length of |
An object of class recipe
with sub-objects:
var_info |
A tibble containing information about the original data set columns. |
term_info |
A tibble that contains the current set of terms in the
data set. This initially defaults to the same data contained in
|
steps |
A list of |
template |
A tibble of the data. This is initialized to be the same as
the data given in the |
jhu <- covid_case_death_rates %>%
filter(time_value > "2021-08-01")
r <- epi_recipe(jhu) %>%
step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
step_epi_ahead(death_rate, ahead = 7) %>%
step_epi_lag(case_rate, lag = c(0, 7, 14)) %>%
step_epi_naomit()
r
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.