reverse-code variables

Hi everyone,

I'm doing the empirical project 11 and all the codes did really well except this one:
I'm writing this:

#### Reverse-code variables
```{r}
WTP = WTP %>%
  mutate_at(c("cog_2", "cog_5", 
              "scepticism_6", "scepticism_7"),
            funs(recode(., "1" = 5, "2" = 4, "3" = 3, 
                        "4" = 2, "5" = 1)))
```

and when I run it, it says like this. Is this an error or this is ok?

Warning message:
`funs()` is deprecated as of dplyr 0.8.0.
Please use a list of either functions or lambdas: 

  # Simple named list: 
  list(mean = mean, median = median)

  # Auto named with `tibble::lst()`: 
  tibble::lst(mean, median)

  # Using lambdas
  list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 

Thank you!
Jennifer

The error message is telling you the solution, you just have to use a lambda function instead of funs()

WTP = WTP %>%
    mutate_at(c("cog_2", "cog_5", 
                "scepticism_6", "scepticism_7"),
              ~ recode(., "1" = 5, "2" = 4, "3" = 3, 
                          "4" = 2, "5" = 1))

Hi,

Thank you for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.