hi Carlos, its not really clear what you're asking here. If all you want is to see what entries are the same and which are different between two matrices of the same dimensions, then this does it: #same m1==m2 #diff m1 != m2
If you want to extract the ones that are the same, indx <- m1==m2 > indx [,1] [,2] [,3] [,4] [1,] TRUE TRUE FALSE TRUE [2,] TRUE TRUE TRUE FALSE [3,] FALSE TRUE FALSE TRUE > m1[indx] 1 0 0 1 0 1 1 1 On 3/19/07, Carlos Guerra <[EMAIL PROTECTED]> wrote: > Good morning to you all, > > I have a problem with a set of matrices that I want to compare. > > I want to see the similarity between them, and to be able to extract the > differences between them. > > They have all the same number of columns and rows, and correspond > presence absence data: > > for example: > > m1 <- matrix(c(1,0,0,0,1,0,1,1,1,1,1,1), 3,4) > m2 <- matrix(c(1,0,1,0,1,0,0,1,0,1,0,1), 3,4) > > I tried with the function cor2m() [package=edodist] but it didn't worked > and my matrices are much bigger than the ones from the example. > > Thank you, > > Carlos > > -- > Carlos GUERRA > > Gabinete de Sistemas de Informacao Geografica > Escola Superior Agraria de Ponte de Lima > Mosteiro de Refoios do Lima > 4990-706 Ponte de Lima > > Tlm: +351 91 2407109 > Tlf: +351 258 909779 > > Reclaim your Inbox...!!! > http://www.mozilla.org/products/thunderbird/ > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics ______________________________________________ R-help@stat.math.ethz.ch 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.