H08 Define a recipe
Use your current course session. Preparation and course runner · R script ↓
H08 Define a recipe
Goal: Store preparation as a reusable object.
Prerequisites: H07.
A recipe is an ordered sequence of transformations. Constructing it does not execute it.
training_step(
"H08",
{
rounding_recipe <- dr_recipe() |>
dr_step_mutate(premium = round(premium, 2))
print(rounding_recipe)
precise_policies <- policies
precise_policies$premium[1] <- 100.126
},
needs = c("H07")
)Expected result: A recipe containing a mutate step.
Task: What should 100.126 become?
Show solution
100.13. We check that during execution in H09.