relevel
that allows you to
move any number of levels to the front.
fct_relevel(f, ...)
f <- factor(c("a", "b", "c"))
fct_relevel(f)
fct_relevel(f, "c")
fct_relevel(f, "b", "a")
# You'll get a warning if the levels don't exist
fct_relevel(f, "d")
Run the code above in your browser using DataLab