Catgeorize entries in a numeric vector according to a list of breakpoints and labels.
Source:R/categorize_vector.R
categorize_vector.Rd
Vectorized version of base::cut()
that
allows each entry in the vector to use different
break points and labels.
Usage
categorize_vector(
values,
break_sets,
label_sets,
include.lowest = TRUE,
order = TRUE,
right = TRUE,
...
)
Arguments
- values
Vector of values to categorize.
- break_sets
sets of category breakpoints, with one set for each entry of
values
, as a list of numeric vectors. Alternatively, a single set of category breakpoints to use for all values, as a one-entry list containing a single numeric vector.- label_sets
sets of labels to associate, with the corresponding breakpoints in
break_sets
, with one set for each entry ofvalues
, as a list of character vectors. Alternatively, a single set of labels to use for all values, as a one-entry list containing a single character vector.- include.lowest
Passed to
base::cut()
. DefaultTRUE
.- order
Passed to
base::cut()
. DefaultTRUE
.- right
Passed to
base::cut()
. DefaultTRUE
.- ...
Additional keyword arguments passed to
base::cut()
.