On 12/15/2012 06:26 AM, Martin Morgan wrote:
In ?setMethod there is this paragraph
It is possible to have some differences between the formal
arguments to a method supplied to 'setMethod' and those of the
generic. Roughly, if the generic has ... as one of its arguments,
then the method may have extra formal arguments, which will be
matched from the arguments matching ... in the call to 'f'. (What
and in practice the expectation is that if a generic has formals x, y,
and ..., then a method will have formals x, y, and possibly additional
arguments.
Thank you very much for your detailed and very helpful reply, Martin! I
now understand that all formal arguments of the generic should be
included in the list of arguments of methods even if one of them is not
needed. My rationale - obviously, I had not looked into the docu well
enough - was that I need not declare arguments that were not used in the
function body anyway. Since I have not gotten a warning so far (until I
experienced the case in my initial posting), I thought this was right.
So, am I right that the problem is rather that the first and third of
the definitions
setMethod("dummyMethod", signature(x="matrix", y="missing"),
function(x) {})
setMethod("dummyMethod", signature(x="data.frame", y="missing"),
function(x, ...) {})
setMethod("dummyMethod", signature(x="list", y="missing"),
function(x, sel=NULL, ...) {})
do NOT result in a warning although they are not correct either while
the second one correctly results in a warning?
Thanks and best regards,
Ulrich
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel