[R] matching rows in matrices

dreamworx Andy_woolston at hotmail.com
Thu Jul 2 14:27:10 CEST 2009


I have a matrix such as this,

     [,1] [,2] [,3]
[1,]    1    1    2
[2,]    2    5    5

and a larger matrix such as this,

     a  b
[1,] 1  5
[2,] 2  5
[3,] 4  9
[4,] 5  8
[5,] 7  8
[6,] 7 10
[7,] 9 10

what I want to do is check the number of times the columns in the first
matrix appear as rows in the second matrix. So for instance in this example
1,5  and 2,5 appear in both so I'd want R to return the number 2. Is there a
function to do this?
-- 
View this message in context: http://www.nabble.com/matching-rows-in-matrices-tp24305831p24305831.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list