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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to