[R] Writing methods for existing generic function

Viechtbauer Wolfgang (STAT) Wolfgang.Viechtbauer at STAT.unimaas.nl
Mon Apr 19 13:51:54 CEST 2010

Dear All,

Suppose I want to write a method for the generic function confint():

> args(confint)
function (object, parm, level = 0.95, ...)

So, it looks like the second and third argument have been predefined in the generic function. Suppose one or several of the predefined arguments don't apply or fit (in some sense) with the design of the rest of the package. What should one do? I see several options:

1) Write a new generic function.
2) Rewrite the package (if possible) so that the arguments of the existing generic function do apply (in some sense).
3) Write a method for the existing generic function, adding the predefined arguments to the method call, but just ignore some/all of them in whatever is being done inside of the method function.

Are there any other options? Is there some recommended practice for this?

Thanks in advance for any feedback!


Wolfgang Viechtbauer                        http://www.wvbauer.com/
Department of Methodology and Statistics    Tel: +31 (43) 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616         Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands         Debyeplein 1 (Randwyck)

More information about the R-help mailing list