| step_assert | R Documentation |
A checkpoint that does NOT change the weights; it verifies conditions and fails (error) or warns if they are not met. Useful to guard a production pipeline (tidymodels-style tests inside the recipe).
step_assert(
spec,
max_deff = NULL,
max_weight_ratio = NULL,
min_n_eff = NULL,
on_fail = c("error", "warning")
)
spec |
a weighting_spec. |
max_deff |
numeric or NULL. Maximum acceptable Kish design effect. |
max_weight_ratio |
numeric or NULL. Maximum allowed final/base weight ratio (per active unit). |
min_n_eff |
numeric or NULL. Minimum acceptable effective sample size. |
on_fail |
"error" (stop the cascade) or "warning". |
The input weighting_spec with this checkpoint appended to its
recipe. The check is recorded only; it is evaluated when prep() is called
and does not modify the weights.
weighting_spec(sample_survey, base_weights = pw) |>
step_assert(max_deff = 5, on_fail = "warning") |> prep()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.