> z <- ddply(past, c("GEO_CNTRY_NAME","PROD_SEG_NAME"), > function(x) summary(lm(VAL~fy,x))$r.squared) > > But when ave is not exactly doing what I need. Above code runs under a > minute for my data set where as ave runs over 8 mins.
It's hard to know without a reproducible example, but I doubt that ddply is the bottleneck in that code. I'd suspect that it's the linear model fitting that takes the majority of the time Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ 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.