[R] S3 and S4 classes

Duncan Murdoch dmurdoch at pair.com
Wed Jul 23 16:55:59 CEST 2003


On Wed, 23 Jul 2003 14:53:56 +0200, Laurent Faisnel
<laurent.faisnel at ariase.com> wrote :
>Could anyone point me out what's S3-like in 
>the following sample and why it is not fully S4-compatible ?

># a function that objects of this class have
>perform <- function(.Object) UseMethod("perform", .Object);

It think this is unnecessary, and somewhat S3-like.  A more S4-looking
way to do the same (?) thing is

setGeneric("perform", function(.Object) standardGeneric("perform"))

but I think this will be generated automatically when you define your
methods.

Duncan Murdoch




More information about the R-help mailing list