has_role | R Documentation |
has_role()
, all_predictors()
, and all_outcomes()
can be used to
select variables in a formula that have certain roles.
In most cases, the right approach for users will be use to use the
predictor-specific selectors such as all_numeric_predictors()
and
all_nominal_predictors()
. In general you should be careful about using
-all_outcomes()
if a *_predictors()
selector would do what you want.
Similarly, has_type()
, all_numeric()
, all_integer()
, all_double()
,
all_nominal()
, all_ordered()
, all_unordered()
, all_factor()
,
all_string()
, all_date()
and all_datetime()
are used to select columns
based on their data type.
all_factor()
captures ordered and unordered factors, all_string()
captures characters, all_unordered()
captures unordered factors and
characters, all_ordered()
captures ordered factors, all_nominal()
captures characters, unordered and ordered factors.
all_integer()
captures integers, all_double()
captures doubles,
all_numeric()
captures all kinds of numeric.
all_date()
captures Date()
variables, all_datetime()
captures
POSIXct()
variables.
See selections for more details.
current_info()
is an internal function.
All of these functions have have limited utility outside of column selection in step functions.
has_role(match = "predictor") has_type(match = "numeric") all_outcomes() all_predictors() all_date() all_date_predictors() all_datetime() all_datetime_predictors() all_double() all_double_predictors() all_factor() all_factor_predictors() all_integer() all_integer_predictors() all_logical() all_logical_predictors() all_nominal() all_nominal_predictors() all_numeric() all_numeric_predictors() all_ordered() all_ordered_predictors() all_string() all_string_predictors() all_unordered() all_unordered_predictors() current_info()
match |
A single character string for the query. Exact matching is used (i.e. regular expressions won't work). |
Selector functions return an integer vector.
current_info()
returns an environment with objects vars
and data
.
data(biomass, package = "modeldata") rec <- recipe(biomass) %>% update_role( carbon, hydrogen, oxygen, nitrogen, sulfur, new_role = "predictor" ) %>% update_role(HHV, new_role = "outcome") %>% update_role(sample, new_role = "id variable") %>% update_role(dataset, new_role = "splitting indicator") recipe_info <- summary(rec) recipe_info # Centering on all predictors except carbon rec %>% step_center(all_predictors(), -carbon) %>% prep(training = biomass) %>% bake(new_data = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.