# NOT RUN {
library(dplyr)
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "creatinine"] <- NA
# optimal binning using binning_by()
bin <- binning_by(heartfailure2, "death_event", "creatinine")
bin
# extract binning result
extract(bin) %>%
head(20)
# }
Run the code above in your browser using DataLab