replace values in vector from a replacement table
On Mon, Jul 30, 2012 at 6:00 PM, jim holtman <jholtman at gmail.com> wrote:
try this:
indx <- match(x, repl.tab[, 1], nomatch = 0) x[indx != 0] <- repl.tab[indx, 2] x
[1] "A" "B" "c" "D" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" [24] "x" "y" "z" "A" "B" "c" "D" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" [47] "u" "v" "w" "x" "y" "z"
This is excellent! Thank you Liviu