With recipes, you can use dplyr-like pipeable sequences of feature engineering steps to get your data ready for modeling. For example, to create a recipe containing an outcome plus two numeric predictors and then center and scale (“normalize”) the predictors:
library(recipes) data(ad_data, package = "modeldata") ad_rec <- recipe(Class ~ tau + VEGF, data = ad_data) %>% step_normalize(all_numeric_predictors()) ad_rec #> Recipe #> #> Inputs: #> #> role #variables #> outcome 1 #> predictor 2 #> #> Operations: #> #> Centering and scaling for all_numeric_predictors()
You may consider recipes as an alternative method for creating and preprocessing design matrices (also known as model matrices) that can be used for modeling or visualization. While R already has long-standing methods for creating such matrices (e.g. formulas and
model.matrix), there are some limitations to what the existing infrastructure can do.
There are several ways to install recipes:
This project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
For questions and discussions about tidymodels packages, modeling, and machine learning, please post on RStudio Community.
If you think you have encountered a bug, please submit an issue.
Either way, learn how to create and share a reprex (a minimal, reproducible example), to clearly communicate about your code.