hadley wickham <h.wickham <at> gmail.com> writes:

> 
> You might also want to take a look at the plyr package:
> 
> install.packages("plyr")
> library(plyr)
> ddply(x, .(A, D), function(df) sum(df$Z))
> dlply(x, .(A, D), function(df) sum(df$Z))
> 

I recently for the first time used the plyr package in an introductory 
course as a general replacement of for "by", "(x)apply", followed by 
do.call gymnastics. It was an amazing step forward to have a nicely 
orthogonal set of function that returns what people expected instead 
of converting everything to a list.

I know, real MEN program assembler and love (x)apply...


Dieter

______________________________________________
R-help@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.

Reply via email to