add_epi_recipe: Add an 'epi_recipe' to a workflow

View source: R/epi_recipe.R

add_epi_recipeR Documentation

Add an epi_recipe to a workflow

Description

Add an epi_recipe to a workflow

Usage

add_epi_recipe(x, recipe, ..., blueprint = default_epi_recipe_blueprint())

remove_epi_recipe(x)

update_epi_recipe(x, recipe, ..., blueprint = default_epi_recipe_blueprint())

Arguments

x

A workflow or epi_workflow

recipe

An epi recipe or recipe

...

Not used

blueprint

A hardhat blueprint used for fine tuning the preprocessing

default_epi_recipe_blueprint() is used.

Note that preprocessing done here is separate from preprocessing that might be done automatically by the underlying model.

Details

add_epi_recipe has the same behaviour as workflows::add_recipe() but sets a different default blueprint to automatically handle epiprocess::epi_df data.

Value

x, updated with a new recipe preprocessor.

See Also

workflows::add_recipe()

  • add_recipe() specifies the terms of the model and any preprocessing that is required through the usage of a recipe.

  • remove_recipe() removes the recipe as well as any downstream objects

  • update_recipe() first removes the recipe, then replaces the previous recipe with the new one.

Examples

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()

workflow <- epi_workflow() %>%
  add_epi_recipe(r)

workflow

r2 <- epi_recipe(jhu) %>%
  step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
  step_epi_ahead(death_rate, ahead = 7)

workflow <- update_epi_recipe(workflow, r2)

workflow <- remove_epi_recipe(workflow)

workflow


cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.