Learn R Programming

recipes (version 0.1.1)

tidy.recipe: Tidy the Result of a Recipe

Description

tidy will return a data frame that contains information regarding a recipe or step within the recipe (when a tidy method for the step exists).

Usage

# S3 method for recipe
tidy(x, number = NA, ...)

Arguments

x

A recipe object (trained or otherwise).

number

An integer or NA. If missing, the return value is a list of the steps in the recipe. If a number is given, a tidy method is executed for that step in the recipe (if it exists).

...

Not currently used.

Value

A tibble with columns that would vary depending on what tidy method is executed. When x is NA, a tibble with columns number (the step iteration), type (the step type, e.g. "nzv", "center"), and a logical column called trained for whether the step has been estimated using prep.

Examples

Run this code
# NOT RUN {
data(okc)

okc_rec <- recipe(~ ., data = okc) %>%
  step_other(all_nominal(), threshold = 0.05) %>%
  step_date(date, features = "dow") %>%
  step_center(all_numeric()) %>%
  step_dummy(all_nominal())

tidy(okc_rec)

tidy(okc_rec, number = 2)
tidy(okc_rec, number = 3)

okc_rec_trained <- prep(okc_rec, training = okc)

tidy(okc_rec_trained)
tidy(okc_rec_trained, number = 3)
# }

Run the code above in your browser using DataLab