[R] calendar-based time-series in R

Gabor Grothendieck ggrothendieck at myway.com
Sun Nov 7 02:20:17 CET 2004

Satoshi Takahama <takahama <at> andrew.cmu.edu> writes:

: Hello,
: I am trying to switch to R from S-PLUS 6.1, and one problem I am having is 
: using R for manipulation of calendar-based time-series. In S-PLUS, I 
: commonly use the functions timeSequence(), timeDate(), and timeSeries() to 
: align/average/aggregate data; and I also do a lot of plotting of 
: time-series data (with calendar-based labels on the x-axis).
: I was wondering if anyone is familiar with the S-PLUS functions and ways 
: to perform the same tasks I mentioned above in R. From what I can gather 
: in the documentation and previous help messages , the 'its' package can 
: provide the same functionalities, but I am not clear on the functions and 
: structure of the data that would correspond to those in S-PLUS. If I am 
: incorrect in my assessment of the 'its' library, I would appreciate any 
: advice on effective ways in which calendar-based time-series can be 
: treated in R.

If you need regular time series such as monthly time series
you can use the ts class in the base of R.  If you need
irregular time series such as time series for business days
then there are four irregular time series classes and packages:

   irts is in package tseries
   its is in package its
   zoo is in package zoo
   timeSeries is in package fBasics (which is part 
                    of Rmetrics, www.rmetrics.org)

I don't have too much experience with irts.  Regarding the

- its is probably the most mature.  It is based on S4 and likely has
  sufficient features for real applications.  A new maintainer
  recently took it over from the original developer.

- zoo is the most consistent with base R as most functions are
  just methods which extend base generics. It allows the user to 
  choose which date class to use whereas the others are hard coded 
  to use POSIXct.  It is based on S3.   zoo is being actively 
  developed.  Its command set includes plot and aggregate.  zoo is 
  also used in the strucchange package.  (I am involved in the 
  development of zoo so I know zoo the best.)

- fBasics/Rmetrics is closest to S and has a particularly
  wide range of functionality.  Be aware that you must set 
  the time zone on your computer to GMT to use it.  It is 
  being actively developed.  It is based on S4.  I believe that it
  has only been tested on Windows (is that right?)  You can 
  get a quick overview of what it has by looking at:

Hope that helps.

More information about the R-help mailing list