step_expose | R Documentation |
recipes
stepstep_expose()
creates a specification of a recipe step that will convert
a data frame of census-level records to exposure-level records.
step_expose(
recipe,
...,
role = NA,
trained = FALSE,
end_date,
start_date = as.Date("1900-01-01"),
target_status = NULL,
options = list(cal_expo = FALSE, expo_length = "year"),
drop_pol_num = TRUE,
skip = TRUE,
id = recipes::rand_id("expose")
)
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose variables
for this step. See |
role |
Not used by this step since no new variables are created. |
trained |
A logical to indicate if the quantities for preprocessing have been estimated. |
end_date |
Experience study end date |
start_date |
Experience study start date. Default value = 1900-01-01. |
target_status |
Character vector of target status values. Default value
= |
options |
A named list of additional arguments passed to |
drop_pol_num |
Whether the |
skip |
A logical. Should the step be skipped when the
recipe is baked by |
id |
A character string that is unique to this step to identify it. |
Policy year exposures are calculated as a default. To switch to calendar
exposures or another exposure length, use pass the appropriate arguments to
the options
parameter.
Policy numbers are dropped as a default whenever the recipe is baked. This
is done to prevent unintentional errors when the model formula includes
all variables (y ~ .
). If policy numbers are required for any reason
(mixed effect models, identification, etc.), set drop_pol_num
to FALSE
.
An updated version of recipe
with the new expose step added to the
sequence of any existing operations. For the tidy
method, a tibble
with
the columns exposure_type
, target_status
, start_date
, and end_date
.
expose()
expo_rec <- recipes::recipe(status ~ ., toy_census) |>
step_expose(end_date = "2022-12-31", target_status = "Surrender",
options = list(expo_length = "month")) |>
prep()
recipes::juice(expo_rec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.