Message-ID: <11417a880812030418i1b6ed1c9kd91dd2a990d875b7@mail.gmail.com>
Date: 2008-12-03T12:18:31Z
From: T Joshi
Subject: intersection of two matrices(updated)
Hi,
I have two matrices as follow:
matrix A =
a=matrix(c(c("abc","abc","bcd","bcd","bce","bce"),c("a1","d2","d1","d2","a1","a2")),6,2)
and matrix B which contains pair of values :
b=matrix(c(c("a1","a1"),c("a2","d2")),2,2)
In short, I wish to find out pairs of values in matrix a[,2] having
same value in a[,1], which occur as a row in matrix b, so that the
output becomes :
abc
bce, or
even better
abc a1 d2
bce a1 a2
How can I do that?
cheers,
Joshi