getCat | R Documentation |
Categorize continuous or semi-continuous variables. This is a utility
function that is useful for writing custom wrapper functions such as
simEUSILC
.
getCat(x, breaks, zeros = TRUE, right = FALSE)
x |
a numeric vector to be categorized. |
breaks |
a numeric vector of two or more break points. |
zeros |
a logical indicating whether |
right |
logical; if |
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.
A factor
containing the categories.
Andreas Alfons
getBreaks
, cut
data(eusilcS)
## semi-continuous variable
breaks <- getBreaks(eusilcS$netIncome,
weights=eusilcS$rb050, equidist = FALSE)
netIncomeCat <- getCat(eusilcS$netIncome, breaks)
summary(netIncomeCat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.