On Apr 26, 2009, at 1:02 PM, Esmail wrote:
I'm trying to compare two matrices made up of bits.
doing a simple comparison of
matA == matB
> identical( matrix((1:4), ncol=2), matrix((1:4), nrow=2))
[1] TRUE
> identical( matrix((1:4), ncol=2), matrix((2:5), nrow=2))
[1] FALSE
yields this sort of output.
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] FALSE TRUE FALSE TRUE TRUE FALSE
[2,] TRUE TRUE TRUE TRUE TRUE TRUE
[3,] FALSE TRUE FALSE FALSE FALSE TRUE
[4,] FALSE TRUE TRUE FALSE FALSE FALSE
[5,] TRUE TRUE TRUE TRUE FALSE FALSE
[6,] TRUE TRUE TRUE TRUE FALSE FALSE
I really would like just one comprehensive value to say TRUE or FALSE.
This is the hack (rather ugly I think) I put together that works,
but there has to be a nicer way, no?
res=pop[1:ROWS,] == keep[1:ROWS,]
if ((ROWS*COL) == sum(res))
{
cat('they are equal\n')
}else
cat('they are NOT equal\n')
That code is meaningless to us without a definition (in R) of ROWS,
COL, keep, and pop
Thanks!
Esmail
______________________________________________
[email protected] 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
[email protected] 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.