Hi R People: I have a monthly time series x.ts which runs from 1/1995 through 12/2003.>x.ts <- ts(x,start=1995,freq=12) >str(x.ts)Time-Series [1:108] from 1995 to 2004: -1.638 -0.236 0.830 -0.548 0.363 ...>My question: is there a way to print the observations from 1/1999 to 6/1999, please? (other than x.ts[49:54]) Thank you in advance! R version 1.9.0 for Windows Sincerely, Laura mailto: lauraholt_983 at hotmail.com a trip to NY
?window Date: Tue, 15 Jun 2004 18:43:04 -0500 From: Laura Holt <lauraholt_983 at hotmail.com> To: <r-help at stat.math.ethz.ch> Subject: [R] time series object Hi R People: I have a monthly time series x.ts which runs from 1/1995 through 12/2003.>x.ts <- ts(x,start=1995,freq=12) >str(x.ts)Time-Series [1:108] from 1995 to 2004: -1.638 -0.236 0.830 -0.548 0.363 ...>My question: is there a way to print the observations from 1/1999 to 6/1999, please? (other than x.ts[49:54]) Thank you in advance!
window() is the normal way to do this. On Tue, 15 Jun 2004, Laura Holt wrote:> Hi R People: > > I have a monthly time series x.ts which runs from 1/1995 through 12/2003. > > >x.ts <- ts(x,start=1995,freq=12) > >str(x.ts) > Time-Series [1:108] from 1995 to 2004: -1.638 -0.236 0.830 -0.548 0.363 > ... > > > > My question: is there a way to print the observations from 1/1999 to 6/1999, > please? > (other than x.ts[49:54])which does not give you a time series, BTW. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595