smbinning.sql: SQL Code

Description Usage Arguments Value Examples

View source: R/smbinning.R

Description

It outputs a SQL code to facilitate the generation of new binned characetristic in a SQL environment. User must define table and new characteristic name.

Usage

1

Arguments

ivout

An object generated by smbinning.

Value

A text with the SQL code for binning.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Training and testing samples (Just some basic formality for Modeling)
pop=chileancredit # Set population
train=subset(pop,Rnd<=0.7) # Training sample
test=subset(pop,Rnd>0.7) # Testing sample
rm(chileancredit) # Remove original dataset

# Example 1: Binning a numeric variable
result=smbinning(df=train,y="FlagGB",x="LnTOB") # Run and save result
smbinning.sql(result)

# Example 2: Binning for a factor variable
result=smbinning.factor(df=train,x="CuWealth",y="FlagGB",maxcat=11)
smbinning.sql(result)

# Example 3: Customized binning for a factor variable
result=smbinning.factor.custom(
  df=train,x="CuWealth",y="FlagGB",
  c("'W01','W02'","'W03','W04','W05'","'W06','W07','W08','W09','W10'"))
smbinning.sql(result)

smbinning documentation built on Nov. 17, 2017, 7:08 a.m.