mcs$maths <- recode(mcs$mths, "1='1. Strongly Disagree';2='2. Disagree';3='3. Agree';4='4.
+ Strongly Agree'")
Error: Argument 2 must be named, not unnamed.
Run `rlang::last_error()` to see where the error occurred.
I'm sure it's something easy, but I can't figure it out. Can anyone help?
you haven't told us which package/library the 'recode' function you are trying to use is from... Can you provide that info ? I will assume you intend the function from dplyr.
An example of the correct syntax follows:
# For character values, recode values with named arguments only. Unmatched
# values are unchanged.
(char_vec <- sample(c("a", "b", "c"), 10, replace = TRUE))
recode(char_vec, a = "Apple")
you can access this example, and in general examples for functions by useing the questionmark and function name in your console. for example