Try changing the recode step to this:
~recode(., "1"=5, "2"=4, "3"=3, "4"=2, "5"=1))
The values on the left side of each recode pair have to be inside quotes or backticks if they're not legal R object names (and legal R names can't start with a number).
A couple of additional suggestions:
-
It looks like you're reversing the numeric values. Instead of a recode, another option is to subtract each value from 6:
~ 6 - . # Small example list(1:5, 6 - 1:5) ## [[1]] ## [1] 1 2 3 4 5 ## [[2]] ## [1] 5 4 3 2 1
-
Instead of listing every column explicitly you could do:
vars(paste0("MIPIP_", c(6:10,15:20))