num_to_cat {scorecardModelUtils}R Documentation

Binning numerical variables based on cuts from IV table

Description

The function takes the num_woe_table output from a class "iv_table". Based on the split points from the num_woe_table, the numerical variables are binned into categories.

Usage

num_to_cat(base, num_woe_table, num_missing = -99999)

Arguments

base

input dataframe

num_woe_table

num_woe_table class from iv table output

num_missing

(optional) imputed missing value for numerical variable (default value is -99999)

Value

The function returns a dataframe after converting the numerical variables into categorical classes.

Author(s)

Arya Poddar <aryapoddar290990@gmail.com>

Examples

data <- iris
data$Y <- sample(0:1,size=nrow(data),replace=TRUE)
x <- c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width")
iv_table_list <- iv_table(base = data,target = "Y",num_var_name = x,cat_var_name = "Species")
num_cat <- num_to_cat(base = data,num_woe_table = iv_table_list$num_woe_table)

[Package scorecardModelUtils version 0.0.1.0 Index]