[R] summing columns of data frame by group
jrkrideau at yahoo.ca
Tue Aug 21 22:44:10 CEST 2007
--- Daniel O'Shea <dan.oshea at dnr.state.mn.us> wrote:
> I have a data frame and one separate vector that is
> a grouping variable for the data frame. I would
> like to take all rows of the data frame belonging to
> each group and then sum the columns with out using a
> for statement.
> Something like: take all rows of group 1 then
> apply(group1.data,1,sum), but do this without having
> to do it separately for each group. Any ideas?
> thank you.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained,
> reproducible code.
More information about the R-help