Tidy the result of a recipe
Source:R/BoxCox.R
, R/YeoJohnson.R
, R/arrange.R
, and 94 more
tidy.recipe.Rd
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).
Usage
# S3 method for class 'step_BoxCox'
tidy(x, ...)
# S3 method for class 'step_YeoJohnson'
tidy(x, ...)
# S3 method for class 'step_arrange'
tidy(x, ...)
# S3 method for class 'step_bin2factor'
tidy(x, ...)
# S3 method for class 'step_bs'
tidy(x, ...)
# S3 method for class 'step_center'
tidy(x, ...)
# S3 method for class 'check_class'
tidy(x, ...)
# S3 method for class 'step_classdist'
tidy(x, ...)
# S3 method for class 'step_classdist_shrunken'
tidy(x, ...)
# S3 method for class 'check_cols'
tidy(x, ...)
# S3 method for class 'step_corr'
tidy(x, ...)
# S3 method for class 'step_count'
tidy(x, ...)
# S3 method for class 'step_cut'
tidy(x, ...)
# S3 method for class 'step_date'
tidy(x, ...)
# S3 method for class 'step_depth'
tidy(x, ...)
# S3 method for class 'step_discretize'
tidy(x, ...)
# S3 method for class 'step_dummy'
tidy(x, ...)
# S3 method for class 'step_dummy_extract'
tidy(x, ...)
# S3 method for class 'step_dummy_multi_choice'
tidy(x, ...)
# S3 method for class 'step_factor2string'
tidy(x, ...)
# S3 method for class 'step_filter'
tidy(x, ...)
# S3 method for class 'step_filter_missing'
tidy(x, ...)
# S3 method for class 'step_geodist'
tidy(x, ...)
# S3 method for class 'step_harmonic'
tidy(x, ...)
# S3 method for class 'step_holiday'
tidy(x, ...)
# S3 method for class 'step_hyperbolic'
tidy(x, ...)
# S3 method for class 'step_ica'
tidy(x, ...)
# S3 method for class 'step_impute_bag'
tidy(x, ...)
# S3 method for class 'step_impute_knn'
tidy(x, ...)
# S3 method for class 'step_impute_linear'
tidy(x, ...)
# S3 method for class 'step_impute_lower'
tidy(x, ...)
# S3 method for class 'step_impute_mean'
tidy(x, ...)
# S3 method for class 'step_impute_median'
tidy(x, ...)
# S3 method for class 'step_impute_mode'
tidy(x, ...)
# S3 method for class 'step_impute_roll'
tidy(x, ...)
# S3 method for class 'step_indicate_na'
tidy(x, ...)
# S3 method for class 'step_integer'
tidy(x, ...)
# S3 method for class 'step_interact'
tidy(x, ...)
# S3 method for class 'step_intercept'
tidy(x, ...)
# S3 method for class 'step_inverse'
tidy(x, ...)
# S3 method for class 'step_invlogit'
tidy(x, ...)
# S3 method for class 'step_isomap'
tidy(x, ...)
# S3 method for class 'step_kpca'
tidy(x, ...)
# S3 method for class 'step_kpca_poly'
tidy(x, ...)
# S3 method for class 'step_kpca_rbf'
tidy(x, ...)
# S3 method for class 'step_lag'
tidy(x, ...)
# S3 method for class 'step_lincomb'
tidy(x, ...)
# S3 method for class 'step_log'
tidy(x, ...)
# S3 method for class 'step_logit'
tidy(x, ...)
# S3 method for class 'check_missing'
tidy(x, ...)
# S3 method for class 'step_mutate'
tidy(x, ...)
# S3 method for class 'step_mutate_at'
tidy(x, ...)
# S3 method for class 'step_naomit'
tidy(x, ...)
# S3 method for class 'check_new_values'
tidy(x, ...)
# S3 method for class 'step_nnmf'
tidy(x, ...)
# S3 method for class 'step_nnmf_sparse'
tidy(x, ...)
# S3 method for class 'step_normalize'
tidy(x, ...)
# S3 method for class 'step_novel'
tidy(x, ...)
# S3 method for class 'step_ns'
tidy(x, ...)
# S3 method for class 'step_num2factor'
tidy(x, ...)
# S3 method for class 'step_nzv'
tidy(x, ...)
# S3 method for class 'step_ordinalscore'
tidy(x, ...)
# S3 method for class 'step_other'
tidy(x, ...)
# S3 method for class 'step_pca'
tidy(x, type = "coef", ...)
# S3 method for class 'step_percentile'
tidy(x, ...)
# S3 method for class 'step_pls'
tidy(x, ...)
# S3 method for class 'step_poly'
tidy(x, ...)
# S3 method for class 'step_poly_bernstein'
tidy(x, ...)
# S3 method for class 'step_profile'
tidy(x, ...)
# S3 method for class 'step_range'
tidy(x, ...)
# S3 method for class 'check_range'
tidy(x, ...)
# S3 method for class 'step_ratio'
tidy(x, ...)
# S3 method for class 'step_regex'
tidy(x, ...)
# S3 method for class 'step_relevel'
tidy(x, ...)
# S3 method for class 'step_relu'
tidy(x, ...)
# S3 method for class 'step_rename'
tidy(x, ...)
# S3 method for class 'step_rename_at'
tidy(x, ...)
# S3 method for class 'step_rm'
tidy(x, ...)
# S3 method for class 'step_sample'
tidy(x, ...)
# S3 method for class 'step_scale'
tidy(x, ...)
# S3 method for class 'step_select'
tidy(x, ...)
# S3 method for class 'step_shuffle'
tidy(x, ...)
# S3 method for class 'step_slice'
tidy(x, ...)
# S3 method for class 'step_spatialsign'
tidy(x, ...)
# S3 method for class 'step_spline_b'
tidy(x, ...)
# S3 method for class 'step_spline_convex'
tidy(x, ...)
# S3 method for class 'step_spline_monotone'
tidy(x, ...)
# S3 method for class 'step_spline_natural'
tidy(x, ...)
# S3 method for class 'step_spline_nonnegative'
tidy(x, ...)
# S3 method for class 'step_sqrt'
tidy(x, ...)
# S3 method for class 'step_string2factor'
tidy(x, ...)
# S3 method for class 'recipe'
tidy(x, number = NA, id = NA, ...)
# S3 method for class 'step'
tidy(x, ...)
# S3 method for class 'check'
tidy(x, ...)
# S3 method for class 'step_time'
tidy(x, ...)
# S3 method for class 'step_unknown'
tidy(x, ...)
# S3 method for class 'step_unorder'
tidy(x, ...)
# S3 method for class 'step_window'
tidy(x, ...)
# S3 method for class '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, andid
is not provided, the return value is a list of the operations in the recipe. If a number is given, atidy
method is executed for that operation in the recipe (if it exists).number
must not be provided ifid
is.- id
A character string or
NA
. If missing andnumber
is not provided, the return value is a list of the operations in the recipe. If a character string is given, atidy
method is executed for that operation in the recipe (if it exists).id
must not be provided ifnumber
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
data(Sacramento, package = "modeldata")
Sacramento_rec <- recipe(~., data = Sacramento) %>%
step_other(all_nominal(), threshold = 0.05, other = "another") %>%
step_center(all_numeric()) %>%
step_dummy(all_nominal()) %>%
check_cols(ends_with("ude"), sqft, price)
tidy(Sacramento_rec)
#> # A tibble: 4 × 6
#> number operation type trained skip id
#> <int> <chr> <chr> <lgl> <lgl> <chr>
#> 1 1 step other FALSE FALSE other_rHEnN
#> 2 2 step center FALSE FALSE center_0byij
#> 3 3 step dummy FALSE FALSE dummy_GJcNB
#> 4 4 check cols FALSE FALSE cols_IeIAm
tidy(Sacramento_rec, number = 2)
#> # A tibble: 1 × 3
#> terms value id
#> <chr> <dbl> <chr>
#> 1 all_numeric() NA center_0byij
tidy(Sacramento_rec, number = 3)
#> # A tibble: 1 × 3
#> terms columns id
#> <chr> <chr> <chr>
#> 1 all_nominal() NA dummy_GJcNB
Sacramento_rec_trained <- prep(Sacramento_rec, training = Sacramento)
tidy(Sacramento_rec_trained)
#> # A tibble: 4 × 6
#> number operation type trained skip id
#> <int> <chr> <chr> <lgl> <lgl> <chr>
#> 1 1 step other TRUE FALSE other_rHEnN
#> 2 2 step center TRUE FALSE center_0byij
#> 3 3 step dummy TRUE FALSE dummy_GJcNB
#> 4 4 check cols TRUE FALSE cols_IeIAm
tidy(Sacramento_rec_trained, number = 3)
#> # A tibble: 6 × 3
#> terms columns id
#> <chr> <chr> <chr>
#> 1 city ROSEVILLE dummy_GJcNB
#> 2 city SACRAMENTO dummy_GJcNB
#> 3 city another dummy_GJcNB
#> 4 zip another dummy_GJcNB
#> 5 type Residential dummy_GJcNB
#> 6 type another dummy_GJcNB
tidy(Sacramento_rec_trained, number = 4)
#> # A tibble: 4 × 2
#> terms id
#> <chr> <chr>
#> 1 latitude cols_IeIAm
#> 2 longitude cols_IeIAm
#> 3 sqft cols_IeIAm
#> 4 price cols_IeIAm