Re: [Rd] S4 setMethod, setGeneric and default arguments

From: Martin Morgan <>
Date: Mon, 22 Nov 2010 08:34:28 -0800

On 11/22/2010 03:23 AM, evilphil wrote:
> <BUMP>
> anyone?

Hi evilphil --

Your method signature doesn't have 'missing' for its third argument, and hence isn't the target of dispatch when the generic is invoked with a missing argument. I guess you'd figured that out and are really asking whether it's consistent with the S4 design, and I think it is.

Why one might provide a default to an argument that is also dispatched on seems like a design decision on your part. Maybe because missing argument dispatch is a common (default) use case? Or to advertise via the generic args what a typical value might be? But dispatch on multiple arguments becomes complicated -- the number of combinations of possible arguments is large, the 'next' method very difficult to reason about -- so might best be avoided if not necessary. The 'signature' argument of setGeneric allows arguments to be included but not dispatched on.


Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

______________________________________________ mailing list
Received on Mon 22 Nov 2010 - 16:40:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 22 Nov 2010 - 16:50:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive