[R] Optimising timeboxing in xts

Hasan Diwan hasan.diwan at gmail.com
Sat Dec 24 06:55:40 CET 2011


I don't know if timeboxing is the correct term to use to accomplish
what I'm attempting, so allow me to explain. I have a set n of tagged
observations in time series t. What I'm interested in is taking i
seconds before and after every n. My code is below:
# observations.xts is an xts time series and arg is the number of
seconds to for the timebox
timeboxes <- sapply(c(1:as.numeric(last(index(observations.xts))-arg)),
function(x) { return(observations.xts[index(x) - arg, index(x)+arg])},
simplify=TRUE)
What I'd like to see in timeboxes is observations.xts elements with
timestamps within the range of abs(arg).
-- 
Sent from my mobile device
Envoyait de mon portable



More information about the R-help mailing list