temp <- bfi[1:100,1:5]
isvalue <- 1:6
newvalue <- psych::cs(one,two,three,four,five,six)
newtemp <- recode(temp,1:5,isvalue,newvalue)
newtemp #characters
temp.num <- psych::char2numeric(newtemp) #convert to numeric
temp.num #notice the numerical values have changed
new.temp.num <- recode(temp.num, 1:5, isvalue=c(3,6,5,2,1,4), newvalue=1:6)
#note that because char2numeric works colum wise, this will fail for small sets
Run the code above in your browser using DataLab