step_naomit {recipes} | R Documentation |
step_naomit
creates a specification of a recipe step that
will remove observations (rows of data) if they contain NA
or NaN
values.
step_naomit( recipe, ..., role = NA, trained = FALSE, columns = NULL, skip = TRUE, id = rand_id("naomit") )
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 |
Unused, include for consistency with other steps. |
trained |
A logical to indicate if the quantities for preprocessing have been estimated. Again included for consistency. |
columns |
A character string of variable names that will
be populated (eventually) by 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. |
An updated version of recipe
with the new step added to the
sequence of any existing operations.
This step can entirely remove observations (rows of data), which can have
unintended and/or problematic consequences when applying the step to new
data later via bake()
. Consider whether skip = TRUE
or
skip = FALSE
is more appropriate in any given use case. In most instances
that affect the rows of the data being predicted, this step probably should
not be applied at all; instead, execute operations like this outside and
before starting a preprocessing recipe()
.
The underlying operation does not allow for case weights.
Other row operation steps:
step_arrange()
,
step_filter()
,
step_impute_roll()
,
step_lag()
,
step_sample()
,
step_shuffle()
,
step_slice()
recipe(Ozone ~ ., data = airquality) %>% step_naomit(Solar.R) %>% prep(airquality, verbose = FALSE) %>% bake(new_data = NULL)