[R] intersection of two matrices
bartjoosen
bartjoosen at hotmail.com
Wed Dec 3 16:15:56 CET 2008
? merge
complexkid wrote:
>
> 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","a2"),c("a1","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
>
> _________________________________
>
> Ms Tejal Joshi
>
> Researcher
> Center for Biological Sequence Analysis
> Technical University of Denmark
> Kemitorvet, Building 208
> DK-2800 Kgs. Lyngby, Denmark
> Phone: +45 4525 6148
> tejal at cbs.dtu.dk
> www.cbs.dtu.dk
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/intersection-of-two-matrices-tp20811826p20814849.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list