step_naomit: Remove observations with missing values

Description Usage Arguments Value See Also Examples

View source: R/naomit.R

Description

step_naomit creates a specification of a recipe step that will add remove observations (rows of data) if they contain NA or NaN values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
step_naomit(
  recipe,
  ...,
  role = NA,
  trained = FALSE,
  columns = NULL,
  skip = FALSE,
  id = rand_id("naomit")
)

## S3 method for class 'step_naomit'
tidy(x, ...)

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 used to create the dummy variables. See selections() for more details. The selected variables must be factors.

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 terms argument.

skip

A logical. Should the step be skipped when the recipe is baked by bake.recipe()? While all operations are baked when prep.recipe() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = FALSE; in most instances that affect the rows of the data being predicted, this step probably should not be applied.

id

A character string that is unique to this step to identify it.

x

A step_naomit object.

Value

An updated version of recipe with the new step added to the sequence of existing steps (if any).

See Also

recipe() prep.recipe() bake.recipe()

Examples

1
2
3
4
recipe(Ozone ~ ., data = airquality) %>%
  step_naomit(Solar.R) %>%
  prep(airquality, verbose = FALSE) %>%
  juice()

recipes documentation built on July 2, 2020, 4:02 a.m.