Thanks! That does exactly what I want. (Heck, maybe this should be included as a default sorted alternative to ave.)
I was thinking of doing it another way using cumsums, but maybe this method is faster. Zhou ______________________________________________ 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.