If I have a 10-year daily xts time series, starting on 1985-01-01 and ending on 1994-12-31, how can I calculate the sum of values for the interval starting on Nov 1 and ending on Mar 31 of the next year, through out the series?
dates <- seq(from = as.Date("1985-01-01"), to = as.Date("1994-12-31"), by = 1)data <- rnorm(length(dates))my.ts <- xts(x=data, order.by=dates)
I need to get
my.ts2[1] = sum(my.ts[1985-11-01 to 1986-03-31])my.ts2[2] = sum(my.ts[1986-11-01 to 1987-03-31])my.ts2[3] = sum(my.ts[1987-11-01 to 1988-03-31])and so on
Note: There are no Feb-29 in the original time series.