Hi,

I have a quick question regarding grouping data in R. I have the following matrix,

A =     0       1       1       0
        1       0       0       1
        1       0       0       1
        1       1       0       0
        1       0       0       1
        0       1       1       0

I would like to learn how I can group the data on unique rows of A and also count the 
number of times the row occurred. The command unique(A) provides a matrix with the 
unique rows, i.e., B

B =     0       1       1       0
        1       0       0       1
        1       1       0       0

but I am also interested in learning how I can count the number of unque rows too. The 
result can be in either one or two matrices, e.g.,

B =     0       1       1       0
        1       0       0       1
        1       1       0       0

Count =         1
                3
                2

or,

C =     0       1       1       0       1
        1       0       0       1       3
        1       1       0       0       2

Thanks in advance.

Rob Kissell
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to