I assume you are looking to apply some function, f, over the last k points of your time series for each point in the series (except for the first k-1 points).
Let z be a vector that represents your time series. Then the j-th column of zl <- matrix(c(z,NA),length(z),k)[-seq(k-1),] # ignore warning is z lagged by j-1. Now apply f to the rows: apply(zl,1,f) --- Date: Mon, 24 Nov 2003 15:19:10 +0000 From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: [R] Bollinger Bands Is there a way to create Bollinger Bands without having to loop on the observations of a time serie? Any help appreciated Thanks ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
