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

# S3 method for step_BoxCox
tidy(x, ...)

# S3 method for step_YeoJohnson
tidy(x, ...)

# S3 method for step_arrange
tidy(x, ...)

# S3 method for step_bin2factor
tidy(x, ...)

# S3 method for step_bs
tidy(x, ...)

# S3 method for step_center
tidy(x, ...)

# S3 method for check_class
tidy(x, ...)

# S3 method for step_classdist
tidy(x, ...)

# S3 method for check_cols
tidy(x, ...)

# S3 method for step_corr
tidy(x, ...)

# S3 method for step_count
tidy(x, ...)

# S3 method for step_cut
tidy(x, ...)

# S3 method for step_date
tidy(x, ...)

# S3 method for step_depth
tidy(x, ...)

# S3 method for step_discretize
tidy(x, ...)

# S3 method for step_dummy
tidy(x, ...)

# S3 method for step_dummy_multi_choice
tidy(x, ...)

# S3 method for step_factor2string
tidy(x, ...)

# S3 method for step_filter
tidy(x, ...)

# S3 method for step_geodist
tidy(x, ...)

# S3 method for step_harmonic
tidy(x, ...)

# S3 method for step_holiday
tidy(x, ...)

# S3 method for step_hyperbolic
tidy(x, ...)

# S3 method for step_ica
tidy(x, ...)

# S3 method for step_impute_bag
tidy(x, ...)

# S3 method for step_impute_knn
tidy(x, ...)

# S3 method for step_impute_linear
tidy(x, ...)

# S3 method for step_impute_lower
tidy(x, ...)

# S3 method for step_impute_mean
tidy(x, ...)

# S3 method for step_impute_median
tidy(x, ...)

# S3 method for step_impute_mode
tidy(x, ...)

# S3 method for step_impute_roll
tidy(x, ...)

# S3 method for step_integer
tidy(x, ...)

# S3 method for step_interact
tidy(x, ...)

# S3 method for step_inverse
tidy(x, ...)

# S3 method for step_invlogit
tidy(x, ...)

# S3 method for step_isomap
tidy(x, ...)

# S3 method for step_kpca
tidy(x, ...)

# S3 method for step_kpca_poly
tidy(x, ...)

# S3 method for step_kpca_rbf
tidy(x, ...)

# S3 method for step_lincomb
tidy(x, ...)

# S3 method for step_log
tidy(x, ...)

# S3 method for step_logit
tidy(x, ...)

# S3 method for check_missing
tidy(x, ...)

# S3 method for step_mutate
tidy(x, ...)

# S3 method for step_mutate_at
tidy(x, ...)

# S3 method for step_indicate_na
tidy(x, ...)

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

# S3 method for check_new_values
tidy(x, ...)

# S3 method for step_nnmf
tidy(x, ...)

# S3 method for step_normalize
tidy(x, ...)

# S3 method for step_novel
tidy(x, ...)

# S3 method for step_ns
tidy(x, ...)

# S3 method for step_num2factor
tidy(x, ...)

# S3 method for step_nzv
tidy(x, ...)

# S3 method for step_ordinalscore
tidy(x, ...)

# S3 method for step_other
tidy(x, ...)

# S3 method for step_pca
tidy(x, type = "coef", ...)

# S3 method for step_pls
tidy(x, ...)

# S3 method for step_poly
tidy(x, ...)

# S3 method for step_profile
tidy(x, ...)

# S3 method for step_range
tidy(x, ...)

# S3 method for check_range
tidy(x, ...)

# S3 method for step_ratio
tidy(x, ...)

# S3 method for step_regex
tidy(x, ...)

# S3 method for step_relevel
tidy(x, ...)

# S3 method for step_relu
tidy(x, ...)

# S3 method for step_rename
tidy(x, ...)

# S3 method for step_rename_at
tidy(x, ...)

# S3 method for step_rm
tidy(x, ...)

# S3 method for step_sample
tidy(x, ...)

# S3 method for step_scale
tidy(x, ...)

# S3 method for step_select
tidy(x, ...)

# S3 method for step_shuffle
tidy(x, ...)

# S3 method for step_slice
tidy(x, ...)

# S3 method for step_spatialsign
tidy(x, ...)

# S3 method for step_sqrt
tidy(x, ...)

# S3 method for step_string2factor
tidy(x, ...)

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

# S3 method for step
tidy(x, ...)

# S3 method for check
tidy(x, ...)

# S3 method for step_unknown
tidy(x, ...)

# S3 method for step_unorder
tidy(x, ...)

# S3 method for step_window
tidy(x, ...)

# S3 method for step_zv
tidy(x, ...)

Arguments

x

A recipe object, step, or check (trained or otherwise).

...

Not currently used.

type

For step_pca, either "coef" (for the variable loadings per component) or "variance" (how much variance does each component account for).

number

An integer or NA. If missing and id is not provided, the return value is a list of the operations in the recipe. If a number is given, a tidy method is executed for that operation in the recipe (if it exists). number must not be provided if id is.

id

A character string or NA. If missing and number is not provided, the return value is a list of the operations in the recipe. If a character string is given, a tidy method is executed for that operation in the recipe (if it exists). id must not be provided if number is.

Value

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

Examples

library(modeldata)
data(okc)

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

tidy(okc_rec)
#> # A tibble: 5 × 6
#>   number operation type   trained skip  id          
#>    <int> <chr>     <chr>  <lgl>   <lgl> <chr>       
#> 1      1 step      other  FALSE   FALSE other_IyjzO 
#> 2      2 step      date   FALSE   FALSE date_FhDIk  
#> 3      3 step      center FALSE   FALSE center_jp5Kj
#> 4      4 step      dummy  FALSE   FALSE dummy_l3nYA 
#> 5      5 check     cols   FALSE   FALSE cols_OruwB  

tidy(okc_rec, number = 2)
#> # A tibble: 1 × 4
#>   terms value ordinal id        
#>   <chr> <chr> <lgl>   <chr>     
#> 1 date  dow   FALSE   date_FhDIk
tidy(okc_rec, number = 3)
#> # A tibble: 1 × 3
#>   terms         value id          
#>   <chr>         <dbl> <chr>       
#> 1 all_numeric()    NA center_jp5Kj

okc_rec_trained <- prep(okc_rec, training = okc)
#> Warning: There are new levels in a factor: NA

tidy(okc_rec_trained)
#> # A tibble: 5 × 6
#>   number operation type   trained skip  id          
#>    <int> <chr>     <chr>  <lgl>   <lgl> <chr>       
#> 1      1 step      other  TRUE    FALSE other_IyjzO 
#> 2      2 step      date   TRUE    FALSE date_FhDIk  
#> 3      3 step      center TRUE    FALSE center_jp5Kj
#> 4      4 step      dummy  TRUE    FALSE dummy_l3nYA 
#> 5      5 check     cols   TRUE    FALSE cols_OruwB  
tidy(okc_rec_trained, number = 3)
#> # A tibble: 2 × 3
#>   terms  value id          
#>   <chr>  <dbl> <chr>       
#> 1 age     32.3 center_jp5Kj
#> 2 height  68.3 center_jp5Kj