H10 Select rows
Use your current course session. Preparation and course runner · R script ↓
H10 Select rows
Goal: Create a deliberate subset.
Prerequisites: H09.
Use a separate product variant so the complete portfolio remains available for metrics.
training_step(
"H10",
{
active_recipe <- rounding_recipe |> dr_step_filter(!cancelled)
active_product <- policy_product |> dr_add_recipe(active_recipe)
active_rows <- dr_collect(dr_run(active_product, write = FALSE))
print(active_rows)
stopifnot(nrow(active_rows) == 5L)
},
needs = c("H09")
)Expected result: Five rows, excluding the marked policy.
Task: Can this subset alone give us a cancellation rate?
Show solution
No: it excludes cancellations. Later we return to the full population.