step_locfimpute: Last Observation Carried Forward Imputation
Description
step_locfimpute creates a *specification* of a recipe
step that will substitute missing values with the most recent variable
value. If the first variable value is missing, it is imputed with the first
present value.
Usage
step_locfimpute(
recipe,
...,
role = NA,
trained = FALSE,
skip = FALSE,
id = rand_id("bagimpute")
)
# S3 method for step_locfimpute
tidy(x, ...)
Value
For step_locfimpute, an updated version of recipe with the new
step added to the sequence of existing steps (if any). For the tidy
method, a tibble with columns terms (the selectors or variables
selected) and trained (a logical that states whether the recipe has
been prepped).
Arguments
recipe
A recipe object. The step will be added to the sequence of
operations for this recipe.
...
One or more selector functions to choose which variables will be
imputed. See [selections()] for more details. For the `tidy` method, these
are not currently used.
role
Not used by this step since no new variables are created.
trained
A logical to indicate if the number of NA values have been
counted in preprocessing.
skip
A logical. Should the step be skipped when the recipe is baked?