createRecipe: Creates recipes to preprocess data set

Description Usage Arguments Details Value Examples

View source: R/createRecipe.R

Description

Creates and returns a recipe object.

Usage

1
2
3
4
5
6
createRecipe(
  data = data,
  responseVar = "response",
  corrValue = 0.9,
  otherValue = 0.01
)

Arguments

data

The training data set

responseVar

the variable that is the response for analysis.

corrValue

The value to remove variables that are highly correlated from dataset. The step will try to remove the minimum number of columns so that all the resulting absolute correlations are less than this value. Default value is .9.

otherValue

The minimum frequency of a level in a factor variable needed to avoid converting its outcome to "other". Default is .01.

Details

The following data transformations are automatically applied to the data:

If a different recipe is needed, I recommend calling the recipes library and building one appropriate for your dataset (this function is hard to automate given the variety of data transformations that can happen for a specific data set).

Value

A recipes::recipe object that has been prepped.

Examples

1
2
3
4
5
6
7
8
library(easytidymodels)
library(dplyr)
utils::data(penguins, package = "modeldata")
resp <- "sex"
split <- trainTestSplit(penguins, stratifyOnResponse = TRUE, responseVar = resp)
formula <- stats::as.formula(paste(resp, ".", sep="~"))
rec <- createRecipe(split$train, responseVar = resp)
rec

amanda-park/easytidymodels documentation built on Dec. 13, 2021, 11:28 a.m.