Hi, all!!
From the help page for 'aggregate': Splits the data into subsets, computes summary statistics for each, and returns the result in a convenient form.
So here's the solution I found to this problem:
blocksums <- function(x,n) { temp <- 1:length(x)-1 temp <- list((temp%/%n)+1) aggregate(x,by=temp,sum)$x }
For instance: blocksums(1:10,3) [1] 6 15 24 10
Hope this helps!! Vicente.
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html