Utility to generate a new characteristic from a factor variable

Description

It generates a data frame with a new predictive characteristic from a factor variable after the binning process.

Usage

1
smbinning.factor.gen(df, ivout, chrname = "NewChar")

Arguments

df

Dataset to be updated with the new characteristic.

ivout

An object generated after smbinning.factor.

chrname

Name of the new characteristic.

Value

A data frame with the binned version of the characteristic analyzed with smbinning.factor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Package loading and data exploration
library(smbinning) # Load package and its data
data(chileancredit) # Load smbinning sample dataset (Chilean Credit)
chileancredit.train=subset(chileancredit,FlagSample==1)
chileancredit.test=subset(chileancredit,FlagSample==0)
result=
smbinning.factor(df=chileancredit.train,y="FlagGB",x="IncomeLevel")
result$ivtable

# Generate new binned characteristic into a existing data frame
chileancredit=
  smbinning.factor.gen(chileancredit,result,"gInc") # Update population