Re: [R] S3 vs. S4

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

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

Check out:

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: mailing list PLEASE do read the posting guide! 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