Re: [R] intersection of two matrices(updated)

2008-12-03 Thread jim holtman
Is this what you want: > a [,1] [,2] [1,] "abc" "a1" [2,] "abc" "d2" [3,] "bcd" "d1" [4,] "bcd" "d2" [5,] "bce" "a1" [6,] "bce" "a2" > b [,1] [,2] [1,] "a1" "a2" [2,] "a1" "d2" > x <- lapply(split(seq(nrow(a)), a[,1]), function(.indx){ + do.call(rbind, lapply(seq(nrow(b)), function(

[R] intersection of two matrices(updated)

2008-12-03 Thread T Joshi
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 s