[R] Intersection of 2 matrices

David Winsemius dwinsemius at comcast.net
Fri Dec 2 14:48:59 CET 2011


On Dec 2, 2011, at 4:20 AM, oluwole oyebamiji wrote:

> Hi all,
>     I have matrix A of 67420 by 2 and another matrix B of 59199 by  
> 2. I would like to find the number of rows of matrix B that I can  
> find in matrix A (rows that are common to both matrices with or  
> without sorting).
>
> I have tried the "intersection" and "is.element" functions in R but  
> it only working for the vectors and not matrix
> i.e,    intersection(A,B) and is.element(A,B).

Have you considered the 'duplicated' function?

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list