Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

terms_select

Select Terms in a Step Function.


Description

This function bakes the step function selectors and might be useful when creating custom steps.

Usage

terms_select(terms, info, empty_fun = abort_selection)

Arguments

terms

A list of formulas whose right-hand side contains quoted expressions. See rlang::quos() for examples.

info

A tibble with columns variable, type, role, and source that represent the current state of the data. The function summary.recipe() can be used to get this information from a recipe.

empty_fun

A function to execute when no terms are selected by the step. The default function throws an error with a message.

Value

A character string of column names or an error of there are no selectors or if no variables are selected.

See Also

Examples

library(rlang)
library(modeldata)
data(okc)
rec <- recipe(~ ., data = okc)
info <- summary(rec)
terms_select(info = info, quos(all_predictors()))

recipes

Preprocessing Tools to Create Design Matrices

v0.1.16
MIT + file LICENSE
Authors
Max Kuhn [aut, cre], Hadley Wickham [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.