From bodenhofer at bioinf.jku.at  Mon Dec 17 09:57:59 2012
From: bodenhofer at bioinf.jku.at (Ulrich Bodenhofer)
Date: Mon, 17 Dec 2012 09:57:59 +0100
Subject: [Rd] Strange, most probably unjustified,
 codoc mismatch for S4 method with one argument plus '...' (re-try)
In-Reply-To: <50CC0A1F.6060504@fhcrc.org>
References: <50CAE773.8070004@bioinf.jku.at> <50CC0A1F.6060504@fhcrc.org>
Message-ID: <50CEDE97.1020706@bioinf.jku.at>

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



[Rd] Strange, most probably unjustified, codoc mismatch for S4 method with one argument plus '...' (re-try)
Ulrich Bodenhofer