I'm not quite sure I understand your question properly, but if you want to change the factor levels of cyl
with mutate()
you could do:
df <- mtcars %>% mutate(cyl = factor(cyl, levels = c(4, 6, 8)))
You would get:
#> str(df$cyl)
# Factor w/ 3 levels "4","6","8": 2 2 1 2 3 2 3 1 1 2 ...