The solution to piping fct_relevel to mutate a subset of variables no longer works since mutate_at has been deprecated. I'm having a tough time piecing together an updated solution using mutate(across(...), fct_relevel(., ....)
, since I get an error that
"Problem with `mutate()` input `..2`.
i `..2 = ~...`.
x `..2` must be a vector, not a `formula` object."
but there is no formula
Let's say I have
f1 <- factor(c("a", "b", "c", "d"))
g2 <- factor(c("a", "b", "c", "d"))
t3 <- factor(c("a", "b", "c", "d"))
f5 <- factor(c("m", "l", "f", "p"))
y8 <- factor(c("a", "b", "c", "d"))
df <- tibble(f1, g2, t3, f5, y8)
and I want to fct_relevel
f1, g2, and y8 (so non-sequential variables) so that you have the factors ordered as "c", "d", "b", "a" for all three of these variables.