[R] Time series indexing/subsetting
    Jason Turner 
    jasont at indigoindustrial.co.nz
       
    Tue Nov 25 03:55:11 CET 2003
    
    
  
Jason.L.Higbee at stls.frb.org wrote:
> R-listers:
> 
> I may be asking too much from R, but is there a way to use time indexing 
> on a time series object.  For instance:
> 
> 
>>tsobject <- ts(1:12, start =1999, freq = 4)
>>tsobject
> 
>      Qtr1 Qtr2 Qtr3 Qtr4
> 1999    1    2    3    4
> 2000    5    6    7    8
> 2001    9   10   11   12
> 
>>tsobject[1999,Qtr4]
> 
Qtr4 isn't a part of the tsobject.  It's produced by the print method 
for ts objects in general.
I believe you want "window"  Something like...
 > window(tsobject, start=c(1999,4), deltat =1)
Time Series:
Start = 1999.8
End = 2001.8
Frequency = 1
[1]  4  8 12
Cheers
Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz
    
    
More information about the R-help
mailing list