Which R time/date class and package to use?

VitoshKa picture VitoshKa · Dec 4, 2010 · Viewed 12k times · Source

I have a limited time series exposure in R. So, I wonder which time/date class (and associated package) would be most appropriate to start with.

Among the plethora of packages available at CRAN task view, I so far favor the timeDate, which is a S4 oriented and has nice support for location dependent particularities such as holidays and daylight saving times.

The community apparently favors the zoo package. chron is also popular.
[edit: Here is a list of time/date implementations which lubridate package refers to: POSIXct, OSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, fts. Also lubridate itself has handy time classes duration, period and interval.]

Would really appreciate if somebody with experience with multiple packages would share his opinion on how the available time/date classes compare in terms of usability and extensibility.

Some points of interest (in random order):

  • internationalization (holidays, timezones etc)
  • readily available statistical modeling procedures
  • readily available visualization tools
  • ease of use
  • compatibility with builtin date/time-series classes (POSIX,ts)
  • extensibility (S4 is desirable)
  • best to use with lubridate

Thanks.

Answer

G. Grothendieck picture G. Grothendieck · Dec 5, 2010

(I am moving this from the comments to the answer portion of stackoverflow at the request of the original poster.)

There is an article in R News 4/1 ("R Help Desk", p. 29) that specifically compares Date, POSIXct and chron. (The 1st two are in core of R and chron is a package.)

timeDate class (in the timeDate package) is based on POSIXct but has extra time zone/financial center support.

For regularly spaced series the the tis package supports many notions of dates.

The mondate package supports accounting dates.

The zoo time series package supports just about any date/time class and also has yearmon and yearqtr for ts compatibility.

The xts time series package works on top of zoo and handles the most common date/time classes by translating them to POSIXct and back again.

There is also information in the Time Series CRAN Task View.