View source: R/step_locfimpute.R
| step_locfimpute | R Documentation |
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.
step_locfimpute(
recipe,
...,
role = NA,
trained = FALSE,
skip = FALSE,
id = rand_id("bagimpute")
)
## S3 method for class 'step_locfimpute'
tidy(x, ...)
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? |
id |
a unique step id that will be used to unprep |
x |
A 'step_locfimpute' object. |
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).
library(recipes) prepped <- recipe(formula = "~.", pima_diabetes) %>% step_locfimpute(weight_class, insulin, skinfold, diastolic_bp) %>% prep() bake(prepped, new_data = pima_diabetes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.