add_woe: Add WoE in a data frame

Description Usage Arguments Details Value Examples

View source: R/woe.R

Description

A tidyverse friendly way to plug WoE versions of a set of predictor variables against a given binary outcome.

Usage

1
add_woe(.data, outcome, ..., dictionary = NULL, prefix = "woe")

Arguments

.data

A tbl. The data.frame to plug the new woe version columns.

outcome

The bare name of the outcome variable.

...

Bare names of predictor variables, passed as you would pass variables to dplyr::select(). This means that you can use all the helpers like starts_with() and matches().

dictionary

A tbl. If NULL the function will build a dictionary with those variables passed to .... You can pass a custom dictionary too, see dictionary() for details.

prefix

A character string that will be the prefix to the resulting new variables.

Details

You can pass a custom dictionary to add_woe(). It must have the exactly the same structure of the output of dictionary(). One easy way to do this is to tweak a output returned from it.

Value

A tibble with the original columns of .data plus the woe columns wanted.

Examples

1
mtcars %>% add_woe("am", cyl, gear:carb)

tidymodels/embed documentation built on Nov. 26, 2021, 3:02 p.m.