I am relatively new to R and currently doing an assignment where I have to run some models. I have some variables that I need to recode, but when running the code I get an error (see R code and error below).
I use library(dplyr)
to execute the command. I have also tried putting ticks around the numbers, inserting dplyr::recode()
and changed the order of the numbers, but still I get the same error.
What does this error mean and how can I fix it?
library(dplyr)
essdk <- essdk %>%
mutate(relig2 = recode(rlgatnd,
"Every day" = 7,
"More than once a week" = 6,
"Once a week" = 5,
"At least once a month" = 4,
"Only on special holy days" = 3,
"Less often" = 2,
"Never" = 1,
"Refusal" = NULL,
"Don't know" = NULL,
"No answer" = NULL,
"NA's" = NULL))
Error: Problem with `mutate()` input `relig2`.
x unused arguments (`Every day` = 7, `More than once a week` = 6, `Once a week` = 5, `At least once a month` = 4, `Only on special holy days` = 3, `Less often` = 2, Never = 1, Refusal = NULL, `Don't know` = NULL, `No answer` = NULL, `NA's` = NULL)
ℹ Input `relig2` is `recode(...)`.
Backtrace:
2. dplyr::mutate(...)
15. dplyr:::h(simpleError(msg, call))