recipes (version 0.1.0)

bake: Apply a Trained Data Recipe

Description

For a recipe with at least one preprocessing step that has been trained by prep.recipe, apply the computations to new data.

Usage

bake(object, ...)

# S3 method for recipe bake(object, newdata = object$template, ...)

Arguments

object

A trained object such as a recipe with at least one preprocessing step.

...

One or more selector functions to choose which variables will be returned by the function. See selections for more details. If no selectors are given, the default is to use all_predictors.

newdata

A data frame or tibble for whom the preprocessing will be applied.

Value

A tibble that may have different columns than the original columns in newdata.

Details

bake takes a trained recipe and applies the operations to a data set to create a design matrix.

If the original data used to train the data are to be processed, time can be saved by using the retain = TRUE option of prep to avoid duplicating the same operations.

A tibble is always returned but can be easily converted to a data frame or matrix as needed.