bin_manual: Bin the variables of a dataset manually

Description Usage Arguments Details Value Examples

View source: R/bin-manual.R

Description

bin_manual cuts numeric, variables according to the mapping specified by the user. This is a standard step in feature engineering or data transformation for scorecard modelling.

Usage

1
bin_manual(.data, bad, ..., check = FALSE)

Arguments

.data

A tibble or data.frame

bad

A variable name indicating which rows are bad borrowers

...

Named lists separated by commas containing mappings of variables to a transformation. Cuts for each variable are separated by c_l or c_r.

check

A logical, if TRUE, bin_manual will check for a minimum of 30 borrowers for each bin. FALSE by default.

Details

Similar to the dplyr mutate, the function takes a named list of lists, separated by commas, with the variable name on the left side, and the transformation on the right side. bin_manual uses the c_l and c_r functions to close where the values of a variable will be cut and transformed into categories.

Value

A tibble or data.frame with the variables transformed into character vectors.

Examples

1
2
3
4
5
bin_manual(german, bad, age = c_l(40, 55))
bin_manual(german,
           bad,
           duration = c_r(15, 32),
           check = TRUE)

jgendrinal/creditscore documentation built on May 30, 2020, 3:51 p.m.