recipes_argument_select {recipes} | R Documentation |
Evaluate a selection with tidyselect semantics for arguments
Description
recipes_argument_select()
is a variant of
recipes_eval_select()
that is tailored to work well with arguments in steps
that specify variables. Such as denom
in step_ratio()
.
This is a developer tool that is only useful for creating new recipes steps.
Usage
recipes_argument_select(
quos,
data,
info,
single = TRUE,
arg_name = "outcome",
call = caller_env()
)
Arguments
quos |
A list of quosures describing the selection. Captured with
|
data |
A data frame to use as the context to evaluate the selection in.
This is generally the |
info |
A data frame of term information describing each column's type
and role for use with the recipes selectors. This is generally the |
single |
A logical. Should an error be thrown if more than 1 variable is
selected. Defaults to |
arg_name |
A string. Name of argument, used to enrich error messages. |
call |
The execution environment of a currently running function, e.g.
|
Details
This function is written to be backwards compatible with previous input types
of these arguments. Will thus accept strings, tidyselect, recipes selections,
helper functions imp_vars()
in addition to the prefered bare names.
Value
A character vector containing the evaluated selection.
See Also
Examples
library(rlang)
data(scat, package = "modeldata")
rec <- recipe(Species ~ ., data = scat)
info <- summary(rec)
info
recipes_argument_select(quos(Year), scat, info)
recipes_argument_select(vars(Year), scat, info)
recipes_argument_select(imp_vars(Year), scat, info)