# load germancredit data
data(germancredit)
# Example I
dt = germancredit[, c("creditability", "credit.amount", "purpose")]
# binning for dt
bins = woebin(dt, y = "creditability")
# converting to woe
dt_woe = woebin_ply(dt, bins=bins)
str(dt_woe)
# converting to bin
dt_bin = woebin_ply(dt, bins=bins, to = 'bin')
str(dt_bin)
# \donttest{
# Example II
# binning for germancredit dataset
bins_germancredit = woebin(germancredit, y="creditability")
# converting the values in germancredit to woe
# bins is a list which generated from woebin()
germancredit_woe = woebin_ply(germancredit, bins_germancredit)
# bins is a data frame
bins_df = data.table::rbindlist(bins_germancredit)
germancredit_woe = woebin_ply(germancredit, bins_df)
# }
Run the code above in your browser using DataLab