summary.recipe: Summarize a Recipe

Description Usage Arguments Details Value See Also Examples

View source: R/recipe.R

Description

This function prints the current set of variables/features and some of their characteristics.

Usage

1
2
## S3 method for class 'recipe'
summary(object, original = FALSE, ...)

Arguments

object

A recipe object

original

A logical: show the current set of variables or the original set when the recipe was defined.

...

further arguments passed to or from other methods (not currently used).

Details

Note that, until the recipe has been trained, the current and original variables are the same.

It is possible for variables to have multiple roles by adding them with add_role(). If a variable has multiple roles, it will have more than one row in the summary tibble.

Value

A tibble with columns variable, type, role, and source.

See Also

recipe() prep.recipe()

Examples

1
2
3
4
5
6
rec <- recipe( ~ ., data = USArrests)
summary(rec)
rec <- step_pca(rec, all_numeric(), num_comp = 3)
summary(rec) # still the same since not yet trained
rec <- prep(rec, training = USArrests)
summary(rec)

Example output

Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union


Attaching package:recipesThe following object is masked frompackage:stats:

    step

# A tibble: 4 x 4
  variable type    role      source  
  <chr>    <chr>   <chr>     <chr>   
1 Murder   numeric predictor original
2 Assault  numeric predictor original
3 UrbanPop numeric predictor original
4 Rape     numeric predictor original
# A tibble: 4 x 4
  variable type    role      source  
  <chr>    <chr>   <chr>     <chr>   
1 Murder   numeric predictor original
2 Assault  numeric predictor original
3 UrbanPop numeric predictor original
4 Rape     numeric predictor original
# A tibble: 3 x 4
  variable type    role      source 
  <chr>    <chr>   <chr>     <chr>  
1 PC1      numeric predictor derived
2 PC2      numeric predictor derived
3 PC3      numeric predictor derived

recipes documentation built on April 16, 2021, 5:09 p.m.