x <- matrix(1:120,ncol=12)
new <- rearrange(x,pattern = c(1,4, 7,10))
new
long <- wide2long(x,width=3,pattern=c(1,4, 7,10)) #rearrange and then make wide
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 column wise, this will fail for small sets
Run the code above in your browser using DataLab