[R] Compare two matrices in r

2012-06-12 Thread HIMANSHU MITTAL
Dear all, I want to compare two matrices . the code must return True only when all the elements of the two matices match. How can this be done in R ? Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Compare two matrices in r

2012-06-12 Thread Özgür Asar
See the example at http://onertipaday.blogspot.com/2007/05/comparing-two-matrices-row-by-row.html Ozgur -- View this message in context: http://r.789695.n4.nabble.com/Compare-two-matrices-in-r-tp4633082p4633087.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Compare two matrices in r

2012-06-12 Thread Rui Barradas
Hello, There are several notions of equal. Note that all(mat1 == mat2) alone doesn't allways do it, it only works if the matrices have equal dimensions. If they don't, it breaks the code. That's the case of the first example below. Try the following. a - matrix(1:16, ncol=2) b -

Re: [R] Compare two matrices in r

2012-06-12 Thread HIMANSHU MITTAL
Thanks It really helped On Tue, Jun 12, 2012 at 5:22 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, There are several notions of equal. Note that all(mat1 == mat2) alone doesn't allways do it, it only works if the matrices have equal dimensions. If they don't, it breaks the code.

[R] compare two matrices

2012-04-10 Thread Kehl Dániel
Dear Members, I have two estimated transition matrices and I want to compare them. In fact I want to check the hypothesis if they come from the same process. I tried to look for some test but all I found was independence test of contingency tables. The following code shows that the usual

Re: [R] compare two matrices

2012-04-10 Thread Rui Barradas
Hello, In Reply To compare two matrices Apr 10, 2012; 9:26am — by Kehl Dániel Kehl Dániel Dear Members, I have two estimated transition matrices and I want to compare them. In fact I want to check the hypothesis if they come from the same process. I tried to look for some test but all

[R] compare two matrices

2010-09-27 Thread xinxin xx
Hi everyone: I have a kinda easy question but i do not know how to solve that in a simple way. I want to compare the rows of two matrices. col1 - c(1,2,3,4,5,6) col2 - c(6,5,4,3,2,1) m - cbind(col1, col2) col3 - c(1,3,2,6) col4 - c(6,3,5,1) n - cbind(col3,

Re: [R] compare two matrices

2010-09-27 Thread Dimitris Rizopoulos
one way is the following: col1 - c(1,2,3,4,5,6) col2 - c(6,5,4,3,2,1) m - cbind(col1, col2) col3 - c(1,3,2,6) col4 - c(6,3,5,1) n - cbind(col3, col4) ind.n - do.call(paste, c(as.data.frame(n), sep = \r)) ind.m - do.call(paste, c(as.data.frame(m), sep = \r)) ind.n %in% ind.m I hope it helps.