I'm a new R learner and also new on this community.
I'm trying to label some ordinal variables in my data frame. Several variables have the same levels and labels.
One example is bellow:
(a3$w1 <- ordered(a3$w1,
levels = c(1,2,3,4,5,6),
labels = c("Strongly disagree","Moderately Disagree", "Slightly disagree", "Slightly agree", "Moderately Agree","Strongly agree")))
I have in the data frame w1-w4 and also another vector nep1-nep16 with the same level and label.
Is there any way to avoid repeating the same code so many times for each variable?
I would like a command than can allow to do it for all similar variables at the same time
Thank you in advance
Can you be more specific?, "it doesn't work." doesn't give us much information to help you, you have to tell us, what have you tried and what error message you are getting. As I said before, please provide a proper reproducible example illustrating your issue.