This is my code:*
data %>%
mutate(r_stemster_3 = recode(stemster_3,
`1` = 7,
`2` = 6,
`3` = 5,
`4` = 4,
`5` = 3,
`6` = 2,
`7` = 1))
This is the error message:
Error in `mutate()`:
ℹ In argument: `r_stemster_3 = recode(...)`.
Caused by error in `recode()`:
! unused arguments (`1` = 7, `2` = 6, `3` = 5, `4` = 4, `5` = 3, `6` = 2, `7` = 1)
Backtrace:
1. data %>% ...
3. dplyr:::mutate.data.frame(...)
4. dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
6. dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
7. mask$eval_all_mutate(quo)
8. dplyr (local) eval()
Error in mutate(., r_stemster_3 = recode(stemster_3, `1` = 7, `2` = 6, :
Caused by error in `recode()`:
! unused arguments (`1` = 7, `2` = 6, `3` = 5, `4` = 4, `5` = 3, `6` = 2, `7` = 1)
I can't figure out what was wrong with my code. Please help fix the code!
I tried variations of the code such as removing the backticks or using single/double quotes instead of backticks. None of them worked.
Also data$stemster_3 is numeric and I want the reverse coded variable to be numeric too.
8 - data$r_stemster_3recodewithdplyr::recode. If you are running both thecaranddplyrpackage, this is most likely the issue(max(data$r_stemster_3)+1) - data$r_stemster_3