fct_other(f, keep, drop, other_level = "Other")
keep
other_level
drop
fct_lump()
x <- factor(rep(LETTERS[1:9], times = c(40, 10, 5, 27, 1, 1, 1, 1, 1))) fct_other(x, keep = c("A", "B")) fct_other(x, drop = c("A", "B"))
Run the code above in your browser using DataCamp Workspace