1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/selections.R
\name{recipes_eval_select}
\alias{recipes_eval_select}
\title{Evaluate a selection with tidyselect semantics specific to recipes}
\usage{
recipes_eval_select(
quos,
data,
info,
...,
allow_rename = FALSE,
check_case_weights = TRUE,
call = caller_env()
)
}
\arguments{
\item{quos}{A list of quosures describing the selection. This is generally
the \code{...} argument of your step function, captured with \code{\link[rlang:enquo]{rlang::enquos()}}
and stored in the step object as the \code{terms} element.}
\item{data}{A data frame to use as the context to evaluate the selection in.
This is generally the \code{training} data passed to the \code{\link[=prep]{prep()}} method
of your step.}
\item{info}{A data frame of term information describing each column's type
and role for use with the recipes selectors. This is generally the \code{info}
data passed to the \code{\link[=prep]{prep()}} method of your step.}
\item{...}{These dots are for future extensions and must be empty.}
\item{allow_rename}{Should the renaming syntax \code{c(foo = bar)} be allowed?
This is rarely required, and is currently only used by \code{\link[=step_select]{step_select()}}.
It is unlikely that your step will need renaming capabilities.}
\item{check_case_weights}{Should selecting case weights throw an error?
Defaults to \code{TRUE}. This is rarely changed and only needed in \code{\link[=juice]{juice()}},
\code{\link[=bake.recipe]{bake.recipe()}}, \code{\link[=update_role]{update_role()}}, and \code{\link[=add_role]{add_role()}}.}
\item{call}{The execution environment of a currently running function, e.g.
\code{caller_env()}. The function will be mentioned in error messages as the
source of the error. See the call argument of \code{\link[rlang:abort]{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 \code{allow_rename = TRUE}, in which
case the names reflect the new names chosen by the user.
}
\description{
\code{recipes_eval_select()} is a recipes specific variant of
\code{\link[tidyselect:eval_select]{tidyselect::eval_select()}} enhanced with the ability to recognize recipes
selectors, such as \code{\link[=all_numeric_predictors]{all_numeric_predictors()}}. See \link{selections}
for more information about the unique recipes selectors.
This is a developer tool that is only useful for creating new recipes steps.
}
\examples{
\dontshow{if (rlang::is_installed("modeldata")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
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)
\dontshow{\}) # examplesIf}
}
|