library(cheapr)
set.seed(123)
ages <- sample(0:80, 100, TRUE)
get_breaks(ages, n = 10)
## To get the same break-points that `cut()` produces, we can do this..
signif(
get_breaks(ages, n = 5, pretty = FALSE,
expand_min = TRUE, expand_max = TRUE), 3
)
levels(cut(ages, 5))
Run the code above in your browser using DataLab