fct_other

Replace unlisted levels with Other

Keeps selected factor levels and maps the rest to an “Other” bucket.

Parameters

Returns

A factor vector with unlisted levels replaced.

Examples

fct_other(fct, keep = ["a", "b"])
fct_other(fct, drop = ["z"], other_level = "Misc")