I'm trying to update my code for reverse coding items in a tibble to use the across() function in dplyr instead of mutate_at(). My present code looks like this:
reversed_items <- c("x1","x4","x12")
data <- data %>%
mutate_at(vars(reversed_items), function(x)6-x )
This works. However, whenever I try to update my code to include the across() function I get this error:
Error: Problem with `mutate()` input `..2`.
x Input `..2` must be a vector, not a `formula` object.
ℹ Input `..2` is `~recode(6 - .x)`.
I've read: https://www.tidyverse.org/blog/2020/04/dplyr-1-0-0-colwise/ But can't get it to work.