CutModules function

Cut a numeric variable into intervals

Cut a numeric variable into intervals

Similar to cut2 function with some modification.

CutModules(x, cuts, m, g, levels.mean = FALSE, digits, minmax = TRUE, oneval = TRUE, onlycuts = FALSE)

Arguments

  • x: Numeric vector to classify into intervals.
  • cuts: Cut points
  • m: Desired minimum number of observations in a group.
  • g: Number of quantile groups.
  • levels.mean: Set to TRUE to make the new categorical vector have levels attribute that is the group means of x instead of interval endpoint labels.
  • digits: Number of significant digits to use in constructing levels. The default is 3, and 5 if levels.mean = TRUE.
  • minmax: If cuts is specified but min(x) < min(cuts) or max(x) > max(cuts) augments cuts to include min and max x.
  • oneval: 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.
  • onlycuts: Set to TRUE to only return the vector of computed cuts. This consists of the interior values plus outer ranges.

Returns

Vector

Author(s)

Md Bahadur Badsha (mbbadshar@gmail.com)

  • Maintainer: Audrey Fu
  • License: GPL (>= 2)
  • Last published: 2022-04-11

Useful links