Skip to content
Prev 66803 / 398502 Next

matching vectors against vectors

You can use merge but to do so you will need to define the common key
first. This can be a rowname in the case of a matrix or names in the
case of a vector.

v1 <- 1:10
names(v1) <- LETTERS[1:10]

v2 <- 101:105
names(v2) <- sample( LETTERS[1:10], 5 )
Row.names  x   y
1          A  1  NA
2          B  2 102
3          C  3 104
4          D  4 103
5          E  5 105
6          F  6  NA
7          G  7  NA
8          H  8 101
9          I  9  NA
10         J 10  NA


Regards, Adai
On Tue, 2005-03-29 at 22:47 +0200, Piet van Remortel wrote: