Re: [R] S3 vs. S4

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon 02 Jan 2006 - 08:06:58 EST

On 1/1/06, Erin Hodgess <hodgess@gator.dt.uh.edu> wrote:
> Dear R People:
>
> Could someone direct me to some documentation on the
> difference between S3 and S4 classes, please?

Check out:

http://www.maths.lth.se/help/R/S3toS4/

and references there.

>
> For example, why would a person use one as opposed to another?
> Maybe pros and cons of each?
>

S3 is simpler (but still quite powerful) and can have higher performance. S4 has more functionality including multiple inheritance and type checking of arguments.

stats4 in the R distribution is an example of an S4 package. You could also look at the its package which is an S4 package for irregular time series and zoo which is an S3 package for the same purpose (although they differ in a number of ways even apart from the different oo infrastructures).

Bioconductor is a large set of packages that use S4.

> Thanks in advance!
>
> R Version 2.2.0 (I'm downloading the new one this afternoon!) Windows.
>
> Happy New Year!
>
>
> Sincerely,
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: hodgess@gator.uhd.edu



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jan 02 08:13:03 2006

This archive was generated by hypermail 2.1.8 : Mon 02 Jan 2006 - 14:43:35 EST