fct_lump() automatically chooses between fct_lump_min(),
fct_lump_prop(), fct_lump_n(), and fct_lump_lowfreq() based on
its arguments. It is kept for backward compatibility, but is
superseded and no longer recommended for new code.
For new code, prefer the more explicit helpers:
fct_lump_min(), fct_lump_prop(), fct_lump_n(), and
fct_lump_lowfreq().
Usage
fct_lump(
f,
n,
prop,
w = NULL,
other_level = "Other",
ties.method = c("min", "average", "first", "last", "random", "max")
)Arguments
- f
A factor (or character vector).
- n
Positive
npreserves the most commonnvalues. Negativenpreserves the least common-nvalues. If there are ties, you will get at leastabs(n)values.- prop
Positive
proplumps values which do not appear at leastpropof the time. Negativeproplumps values that do not appear at most-propof the time.- w
An optional numeric vector giving weights for frequency of each value (not level) in
f.- other_level
Value of level used for "other" values. Always placed at end of levels.
- ties.method
A character string specifying how ties are treated. See
rank()for details.
