I'm trying to compare two matrices made up of bits.

doing a simple comparison of

        matA == matB

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')

Thanks!

Esmail

______________________________________________
R-help@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.

Reply via email to