Re: [R] Indexing zoo objects

2010-03-03 Thread Gabor Grothendieck
I would normally use 'which', as already suggested, but if, as in your example, the 26th were the last in the series and this is known then these would all work too to get the time of the 3rd last (2nd prior to the last): time(z)[length(z) - 2] time(tail(z, 3)[1, ]) head(tail(time(z), 3), 1) tim

Re: [R] Indexing zoo objects

2010-03-03 Thread Achim Zeileis
On Wed, 3 Mar 2010, Worik R wrote: I have a zoo object z z Value 2003-11-15 2.22 2003-11-17 2.26 2003-11-19 2.28 2003-11-22 2.54 2003-11-26 2.55 I wish to find the entry 2 entries before "2003-11-26". How do I do this? If you want to find out that this is at the third positio

[R] Indexing zoo objects

2010-03-02 Thread Worik R
I have a zoo object z z Value 2003-11-15 2.22 2003-11-17 2.26 2003-11-19 2.28 2003-11-22 2.54 2003-11-26 2.55 I wish to find the entry 2 entries before "2003-11-26". How do I do this? I thought I might be able to say index(z["2003-11-26"]) and have it return 5 so I could then s