fct_lump_n

Keep the most frequent factor levels

Collapses infrequent factor levels into an “Other” bucket while keeping the most frequent levels.

Parameters

Returns

A factor vector with infrequent levels lumped.

Examples

fct_lump_n(fct, n = 5)
fct_lump_n(fct, n = 3, other_level = "Misc")