small2other {multiUS} | R Documentation |
Recoding the smallest categories to "other" value in case of too many or too small categories.
Description
The smallest categories are recoded to "other" or user specified string. The variables is converted to factor if not already.
Usage
small2other(
x,
maxLevels = 12,
minFreq = 0,
otherValue = "other",
convertNA = TRUE,
orderLevels = FALSE,
otherLast = FALSE
)
Arguments
x |
The variable to be recoded. |
maxLevels |
The maximum number of levels after recoding |
minFreq |
The minimal frequency after recoding. |
otherValue |
The name give to the new category |
convertNA |
Should the |
orderLevels |
How should the categories be ordered. Possible values are:
|
otherLast |
Only used if category with |