I have a big set of survey data containing 110 variables. Some answers range from 1 to 5, where 1 is best and 5 is worst. For analysis I would like to invert that, where 5=1, 4=2, 3=3, 2=4, and 1=5.
If I put it into an object it works:
x_inv <- recode(x, "5=1; 4=2;3=3;2=4; 1=5")
Yet if I do it that way, I will end having 110 objects. Thus I am looking for a way to change that variable directly within the data frame.
That for I tried just recode:
recode(x, "5=1; 4=2;3=3;2=4; 1=5")
That works if you look at that variable, yet if you ask for the mean, it hasn't changed, eg from 1.82 to 4.18.
Does anyone know how to do that?