I have this dataset I have loaded in called "Data". Within this dataset, it includes various likert scale questionnaires. Using an example, in this dataset I have variables EQ1 - EQ10 which represents a 10 item empathy questionnaire. Currently in this likert scale, it is:
- Strongly agree
- Slightly agree
- Strongly disagree
- Slightly disagree
For items EQ1, 2, 4, 6 and 9, Strongly agree = 2, Slightly agree = 1 and the other 2 options = 0. Then the other items need to be reverse coded. I am really struggling with how to do this.
I've tried this:
Data <- read.csv ("data.csv")
data <- data %>%
mutate(
EQ1 = recode(EQ1, "strongly agree" = 2, "slightly agree" = 1, "strongly disagree" = 0, "slightly disagree" = 0, .default = NA),
EQ2 = recode(EQ2, "strongly agree" = 2, "slightly agree" = 1, "strongly disagree" = 0, "slightly disagree" = 0, .default = NA),
EQ4 = recode(EQ4, "strongly agree" = 2, "slightly agree" = 1, "strongly disagree" = 0, "slightly disagree" = 0, .default = NA),
EQ6 = recode(EQ6, "strongly agree" = 2, "slightly agree" = 1, "strongly disagree" = 0, "slightly disagree" = 0, .default = NA),
EQ9 = recode(EQ9, "strongly agree" = 2, "slightly agree" = 1, "strongly disagree" = 0, "slightly disagree" = 0, .default = NA))
But I get this error: Error in UseMethod("mutate") :
no applicable method for 'mutate' applied to an object of class "function"
Please help