Re: [R] grouped colSums without for loops?

From: Hans Ekbrand <hans_at_sociologi.cjb.net>
Date: Tue, 18 Mar 2008 23:19:27 +0100

On Tue, Mar 18, 2008 at 12:05:23PM +0100, Albert Greinoecker wrote:
> try:
> aggregate(d[,2:3], by=list(d$foo), FUN=sum)

Great! Now I can get a data.frame as well as a list, thanks!

-- 
        Hans Ekbrand (http://sociologi.cjb.net) <hans@sociologi.cjb.net>
Signature generated by Signify v1.14.  For this and more, visit http://www.debian.org/

______________________________________________ R-help_at_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.

Received on Tue 18 Mar 2008 - 22:30:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Mar 2008 - 23:30:24 GMT.

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

list of date sections of archive