# NOT RUN {
library(dplyr)
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "creatinine"] <- NA
# optimal binning
bin <- binning_by(heartfailure2, "death_event", "creatinine")
bin
# summary optimal_bins class
summary(bin)
# performance table
attr(bin, "performance")
# visualize all information for optimal_bins class
# plot(bin)
# visualize WoE information for optimal_bins class
# plot(bin, type = "WoE")
# visualize all information without typographic
# plot(bin, typographic = FALSE)
# extract binned results
extract(bin) %>%
head(20)
# }
Run the code above in your browser using DataLab