cboettig/earlywarning — Issue #2: window_<indicator> should return object of same length as original time series, padded by NAs
Author: cboettig
Created: 2012-02-28 23:23:42+00:00
State: open

For example

```r
window_var <- function(X, windowsize=(length(X)/2)){
out <- sapply(0:(length(X)-windowsize), function(i){
var(X[(i+1):(i+windowsize)])
})
c(rep(NA, length(X)-length(out)), out)
}

window_autocorr <- function(X, windowsize=(length(X)/2)){
out <-sapply(0:(length(X)-windowsize),
function(i)
acf(X[(i+1):(i+windowsize)], lag.max=1, plot=F)$acf[2])
c(rep(NA, length(X)-length(out)), out)
}
```