[R] grouped colSums without for loops?

Hans Ekbrand hans at sociologi.cjb.net
Tue Mar 18 23:19:27 CET 2008


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 


More information about the R-help mailing list