[Rd] s4 methods and base

Marsland, John John.Marsland at CommerzbankIB.com
Wed Aug 6 09:48:46 MEST 2003


This is the inconsistency I am talking about:

> getClass("POSIXt")
Virtual Class

No Slots, prototype of class "NULL"

Extends: 
Class "POSIXct", directly
Class "oldClass", by class "POSIXct"
> getClass("POSIXct")
Virtual Class

No Slots, prototype of class "NULL"

Extends: "oldClass"

Known Subclasses: "POSIXt"
> getClass("POSIXlt")
Error in getClass("POSIXlt") : "POSIXlt" is not a defined class

But to quote from the online help:

"POSIXct" is more convenient for including in data frames, and "POSIXlt" is
closer to human-readable forms. A virtual class "POSIXt" inherits from both
of the classes: it is used to allow operations such as subtraction to mix
the two classes. 

In a S4 world wouldn't make more sense for POSIXt to be a virtual superclass
and POSIXct and POSIXlt to be subclasses?

But I think you have answered my other question about the future of s3.

> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: 05 August 2003 19:05
> To: Marsland, John
> Cc: R-devel at stat.math.ethz.ch
> Subject: Re: [Rd] s4 methods and base
> 
> 
> On Tue, 5 Aug 2003, Marsland, John wrote:
> 
> > I'm sure that many people are in the same position as me in 
> that they are
> > trying to write packages and code that is vaguely "future proof".
> > 
> > Would it be possible to get some guidance on how the R-core 
> team see the
> > evolution of the "base" package with regard to s4 methods.
> > 
> > There seem to be quite a lot of inconsistencies between s3 
> and s4 methods
> > and classes currently and this (I'm sure) is only to be 
> expected in a period
> > of transition. eg POSIXlt vs POSIXt and POSIXct. And there 
> seem like dozens
> 
> Those are S3 classes, and there is nothing transitional about them!
> There are no S4 classes in `base R' that I am aware of to be 
> inconsistent.
> Are you sure you understand the difference?
> 
> > of print methods to convert 
> 
> First you need to define S4 classes, and there are currently 
> no moves to 
> do that for the statistical modelling software, for example.
> 
> > - it's not an enviable task and I'm sure it will
> > take time! ... if indeed you do see R being purged of s3 by 
> some point in
> > the future.
> 
> We are still using S3 classes designed a decade ago, and I 
> expect to be 
> still using them in another decade.  I even have S4 versions 
> of some of 
> them (e.g. lda, multinom) and no plans to use those in R.
> 
> -- 
> 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
> 


********************************************************************** 
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}



More information about the R-devel mailing list