Similar to cut2 function with some modification.
CutModules(x, cuts, m, g, levels.mean = FALSE, digits, minmax = TRUE,
oneval = TRUE, onlycuts = FALSE)
Numeric vector to classify into intervals.
Cut points
Desired minimum number of observations in a group.
Number of quantile groups.
Set to TRUE to make the new categorical vector have levels attribute that is the group means of x instead of interval endpoint labels.
Number of significant digits to use in constructing levels. The default is 3, and 5 if levels.mean = TRUE.
If cuts is specified but min(x) < min(cuts) or max(x) > max(cuts) augments cuts to include min and max x.
If an interval contains only one unique value, the interval will be labeled with the formatted version of that value instead of the interval endpoints unless oneval = FALSE.
Set to TRUE to only return the vector of computed cuts. This consists of the interior values plus outer ranges.
Vector