The smallest categories are recoded to "other" or user specified string. The variables is converted to factor if not already.
small2other(
x,
maxLevels = 12,
minFreq = 0,
otherValue = "other",
convertNA = TRUE,
orderLevels = FALSE,
otherLast = FALSE
)The variable to be recoded.
The maximum number of levels after recoding
The minimal frequency after recoding.
The name give to the new category
Should the NA values be converted to ordinary values. If TRUE, they are converted to string "NA". If FALSE, there are left as missing and ignored in the recording.
How should the categories be ordered. Possible values are:
FALSE - do not change the ordering (default)
alpha - alphabetically; and
freq - based on frequencies (highest frequencies first).
Only used if category with otherValue was created. If TRUE, the otherValue is placed as last category regardless of the orderLevels argument. Defaults to FALSE.