Re: [R] aggregate data.frame by one column

From: Guo Wei-Wei <wwguocn_at_gmail.com>
Date: Fri 30 Jun 2006 - 14:23:43 EST

Hi Andrew,

Thank you very much! It works so well than I can expect.

All the best,
Wei-Wei

2006/6/30, Andrew Robinson <A.Robinson@ms.unimelb.edu.au>:
> Hi Wei-Wei,
>
> try this:
>
> eva.agg <- aggregate(x = list(
> VC1=eva$VC1,
> EO1=eva$EO1,
> EO2=eva$EO2,
> EO3=eva$EO3,
> EO4=eva$EO4,
> EO5=eva$EO5
> ),
> by = list(PARTNO=eva$PARTNO),
> FUN = mean, na.rm = TRUE)
>
> eva.agg$NUM <- aggregate(eva$PARTNO, list(eva$PARTNO), length)
>
> Cheers
>
> Andrew
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 30 14:31:22 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 30 Jun 2006 - 18:13:25 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.