[R] Counting elements in 2 rows of a matrix
Fredy Mejía
fmejia at mac.com
Sat Aug 31 07:22:43 CEST 2002
Dear R-users:
Sorry to bother so late with this question, which surely has simple answer.
I'm working with matrices that contain either "1" or "0", for example:
[,1] [,2] [,3] [,4] [,5]
A 1 0 1 0 0
B 0 1 0 1 0
C 1 0 1 0 0
D 1 1 1 0 1
I want to count the number of "1" common to, say, A and B, the number of
"1" that appear only in A and the number of "1" that appear only in B.
Please let me know if there's a simple way of doing this without the
complicated for...next loops that have come across my mind.
Fredy Mejía
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 656 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020830/e6781301/attachment.bin
More information about the R-help
mailing list