Skip to content
Prev 277999 / 398506 Next

Need help with table() and apply()

It might be good if you told us the problem you are trying to solve.
Why do you have factors in the dataframe?  Can you just have the
values?  Do you want to count the 'levels' of the factors in a row, or
do you want to count the numeric they represent (in your case it is
the same, so I wonder why the factor).

Here is one way of doing it to count what the 'level' values are:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    2    3    2    2    1    2    1    2    2     2
[2,]    1    4    7    3    6    5    0    1    1     2
[3,]    3    1    1    4    2    1    6    5    5     3
[4,]    4    2    0    1    1    2    3    2    2     3
So tell us what you want to do, not how you want to do it.

2011/11/20 jim holtman <jholtman at gmail.com>: