How to swap (translate) values inside a vector – stackoverflow.com

Let vetA <- c(1,2,1,2,1,3,4,1,2,3,2,1,4). What are the possibilities so I could do the following swap? Swap: 1 be 3 2 be 4 3 be 2 4 be 1 I have tried this: vetB <- as.factor(vetA) levels(...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

0 Comment to "How to swap (translate) values inside a vector – stackoverflow.com"