Categorize continuous or semi-continuous variables. This is a utility
function that is useful for writing custom wrapper functions such as
simEUSILC.
Usage
getCat(x, breaks, zeros = TRUE, right = FALSE)
Arguments
x
a numeric vector to be categorized.
breaks
a numeric vector of two or more break points.
zeros
a logical indicating whether x is semi-continuous, i.e.,
contains a considerable amount of zeros. See “Details” on how this
affects the behavior of the function.
right
logical; if zeros is not TRUE, this indicates
whether the intervals should be closed on the right (and open on the left)
or vice versa.
Details
If zeros is TRUE, 0 is added to the break points and treated
as its own factor level. Consequently, intervals for negative values are
left-closed and right-open, whereas intervals for positive values are
left-open and right-closed.