# Generate data for the example
# \donttest{
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 20), "platelets"] <- NA
# Binning the platelets variable. default type argument is "quantile"
bin <- binning(heartfailure2$platelets, nbins = 5)
plot(bin)
# Using another type arguments
bin <- binning(heartfailure2$platelets, nbins = 5, type = "equal")
plot(bin)
bin <- binning(heartfailure2$platelets, nbins = 5, type = "pretty")
plot(bin)
# "kmeans" and "bclust" was implemented by classInt::classIntervals() function.
# So, you must install classInt package.
if (requireNamespace("classInt", quietly = TRUE)) {
bin <- binning(heartfailure2$platelets, nbins = 5, type = "kmeans")
plot(bin)
bin <- binning(heartfailure2$platelets, nbins = 5, type = "bclust")
plot(bin)
}
# }
Run the code above in your browser using DataLab