[R] rowsum- is there a countsum
Anders Bjørgesæter
abjrges at getmail.no
Sat Jan 26 15:13:40 CET 2008
Hello
Is there an analogous function to ”rowsum” that count the numbers
according to a given vector (preferably larger than a given value)
instead of summing them?
E.g. rowsum(x, group)
X is the dataframe, A B C
5 0 0
1 3 3
0 1 12
and group is the vector; 1,1,2
rowsum gives: A B C
1 6 3 3
2 0 1 12
I want: A B C
1 2 1 1
2 0 1 1
for e.g. count all > 0.
Best Regards
Anders
More information about the R-help
mailing list