[R] question

Lida Zeighami lid.zigh at gmail.com
Fri Jun 26 20:11:20 CEST 2015


Hi there,

I have a matrix (n*m) which rows including 0,1,2
I want to know the frequency of each elements (0 , 1 , 2) separately for
each row!
for example :

     1    2    3   4    5    6     7

A   0     1   1    0     2    2    2
B   1     1   1    2    0    0     2
C   2    1   1    0     0    0    2
D   1     1   0    0    0    2     2
E   0     2   1    1     2    2    2

I want to this output:

     1    2    3   4    5    6     7         fr0
fr1               fr2

A   0     1   1    0     2    2    2           2                  2
     3
B   1     1   1    2    0    0     2           3
2             2
C   2    1   1    0     0    0     2          3                   2
     2
D   1     1   0    0    0    2     2           2                  3
        2
E   0     2   1    1     2    2    2           1
2            4

Thanks

	[[alternative HTML version deleted]]



More information about the R-help mailing list