I have an xts object with several event indicators. I need to break it down into certain events, so that all records from this event until the next event will be stored in the same one xts, eventually creating a list of objects xts, each of which contains the event as the last record without any other events of the same type .
example:
ts = as.Date(Sys.Date()-99:0)
e1 = numeric(100);e1[10*1:10]=1
e2 = numeric(100);e2[15*1:6]=1
y = 1:100
xs = as.xts(cbind(e1,e2,y),order.by=ts)
ee = e1*e2==1
Your suggestions will be greatly appreciated.
source
share