Hi R'ers-

I'll believe this can be done and that I'm just not clever enough.

I'm trying to do this in 2D, but i think we have the same problem in 1D.

#Assume you have some 1D time series
d<-rnorm(100)

#Say you want to get the average over intervals of different lengths
#like from time 10 to time 24 and time 51 to time 86
starts <- c(10,51)
ends <- c(24,86)
results <-c(NA,NA)

#then you'd typically loop
for (i in 1:2) { results[i] <- mean(d[starts[i]:ends[i]) }

can it be done without looping?

Thanks in advance.

James

	[[alternative HTML version deleted]]

