[Rd] S3 vs S4 classes
Rossi, Peter E.
Peter.Rossi at chicagogsb.edu
Sat Feb 17 17:54:43 CET 2007
I have developed a package, bayesm, which uses existing classes of
objects. I would like
to add a new class corresponding to objects from this package.
I have been reading about classes and all sources tell me that I should
use
so-called "new" or S4 classes.
However, a major purpose of defining a class for my package would be to
add methods to the existing generic functions: print, plot, and
summary. My understanding
is that these functions work with the "old" or S3 classes.
If I want to use S4 classes, do I need to write new generic functions or
is there
as way to "extend" the existing generics to work with S4 classes and
objects. I may
be using the wrong word here "extend" but I hope that everyone
understands the point.
If I have to write new generic functions, it is a simply matter of
registering the pre-existing
methods based on S3 objects? Or do you basicaly have to start from
scratch -- i.e.
the two types of classes, methods and generic functions are distinct?
thanks
peter r
................................
Peter E. Rossi
Joseph T. and Bernice S. Lewis Professor of Marketing and Statistics
Editor, Quantitative Marketing and Economics
Rm 353, Graduate School of Business, U of Chicago
5807 S. Woodlawn Ave, Chicago IL 60637
Tel: (773) 702-7513 | Fax: (773) 834-2081
More information about the R-devel
mailing list