# NOT RUN {
# Load library and its dataset
library(smbinning) # Load package and its data
pop=smbsimdf1 # Set population
train=subset(pop,rnd<=0.7) # Training sample
# Binning a factor variable on training data
result=smbinning.factor(train,x="home",y="fgood")
# Example: Append new binned characteristic to population
pop=smbinning.factor.gen(pop,result,"g1home")
# Split training
train=subset(pop,rnd<=0.7) # Training sample
# Check new field counts
table(train$g1home)
table(pop$g1home)
# }
Run the code above in your browser using DataLab