Skip to content
Back to formatted view

Raw Message

Message-ID: <20080318221924.GB9708@amin>
Date: 2008-03-18T22:19:27Z
From: Hans Ekbrand
Subject: grouped colSums without for loops?
In-Reply-To: <1205838323.6332.14.camel@localhost>

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 at sociologi.cjb.net>
Signature generated by Signify v1.14.  For this and more, visit http://www.debian.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080318/e5eca97d/attachment.bin