[Rd] setGeneric for residuals, etc

Johann Hibschman jhibschman at gmail.com
Thu Jan 20 16:24:50 CET 2011


I'm experimenting with a few model-fitting classes of my own.  I'm
leaning towards using S4 for my classes, but the R functions I'd want to
override (residuals, predict, etc.) are all S3 methods.

As I understand it, I could do setGeneric("residuals"), then add S4
specializations to it.  However, I don't understand the full
consequences of doing this.  Are there any drawbacks?  Is there some
code that will not run properly if I do this?  It feels like I'm
reaching in and modifying a core R function, which makes me nervous.

To put it another way, if it's completely transparent and causes no
problems, why isn't it done by default?

(If it matters, I'm still on 2.10.1, but I can take it up with global
architecture if there are compelling changes in later versions.)

Thanks,
Johann



More information about the R-devel mailing list