I have an XTS that is part of a list returns$sig
and from that XTS, I pull out a set of elements based on some conditions and store the Index in a variable tstart
.
> tstart <- index(returns$sig[which(returns$sig != lag(returns$sig,1) & returns$sig != 0)])
> length(tstart)
[1] 599
When I try and access the returns$sig
XTS again with the dates in tstart
, I get a XTS with a different length:
> length(returns$sig[tstart])
[1] 478
It should return something with length 599. If I try and access the XTS in a different way, I do get something of the same length:
> length(returns$sig[match(tstart,index(returns$sig))])
[1] 599
Spent hours on this and haven't found a resolution. Is there something obvious that I am doing wrong? And to make matters worse, I swear that length(returns$sig[tstart])
returned 599 yesterday and everything was working fine.