[R] questions on generic functions

Wayne (Yanwei) Zhang actuaryzhang at uchicago.edu
Sun Jan 3 09:28:35 CET 2010


Hi all,

I'm trying to build a package, but run into problems with generic functions. 

I have two classes "aa" and "bb", and defined the function "summary.bb". Now I 
want to make "summary.bb" the default method for both classes "aa" and "bb". 
That is, if I have two objects  "object.aa" and "object.bb" from class "aa" and "bb" 
respectively, the function call "summary(object.aa)" and "summary(object.bb)" will 
apply the function "summary.bb" at default.  How can I do that? Should I use 
"setMethod" ?  Thanks a lot. 

Regards,
Wayne



More information about the R-help mailing list