recipes_eval_select: Evaluate a selection with tidyselect semantics specific to...

View source: R/selections.R

recipes_eval_selectR Documentation

Evaluate a selection with tidyselect semantics specific to recipes

Description

recipes_eval_select() is a recipes specific variant of tidyselect::eval_select() enhanced with the ability to recognize recipes selectors, such as all_numeric_predictors(). See selections for more information about the unique recipes selectors.

This is a developer tool that is only useful for creating new recipes steps.

Usage

recipes_eval_select(
  quos,
  data,
  info,
  ...,
  allow_rename = FALSE,
  check_case_weights = TRUE,
  call = caller_env()
)

Arguments

quos

A list of quosures describing the selection. This is generally the ... argument of your step function, captured with rlang::enquos() and stored in the step object as the terms element.

data

A data frame to use as the context to evaluate the selection in. This is generally the training data passed to the prep() method of your step.

info

A data frame of term information describing each column's type and role for use with the recipes selectors. This is generally the info data passed to the prep() method of your step.

...

These dots are for future extensions and must be empty.

allow_rename

Should the renaming syntax c(foo = bar) be allowed? This is rarely required, and is currently only used by step_select(). It is unlikely that your step will need renaming capabilities.

check_case_weights

Should selecting case weights throw an error? Defaults to TRUE. This is rarely changed and only needed in juice(), bake.recipe(), update_role(), and add_role().

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of rlang::abort() for more information.

Value

A named character vector containing the evaluated selection. The names are always the same as the values, except when allow_rename = TRUE, in which case the names reflect the new names chosen by the user.

See Also

developer_functions

Examples


library(rlang)
data(scat, package = "modeldata")

rec <- recipe(Species ~ ., data = scat)

info <- summary(rec)
info

quos <- quos(all_numeric_predictors(), where(is.factor))

recipes_eval_select(quos, scat, info)


recipes documentation built on July 4, 2024, 9:06 a.m.