Re: [Rd] Using missing() in a S4 method with extra arguments

From: Andreas Borg <>
Date: Fri, 11 Mar 2011 16:22:27 +0100

Hi Martin,

in the real function, I am not dispatching on the argument for which I test missingness, but it might be a good idea to do so - this way I could make the function tidier by relocating different branches to seperate methods. Thanks for the suggestion!


> if you're testing for the missing-ness of y, and y is in the function
> signature, then use that for dispatch
> setMethod(fun, c("character", "missing"),
> function(x=0, y=0, z=0, ...) "missing")
> setMethod(fun, c("character", "ANY"),
> function(x=0, y=0, z=0, ...) "not missing")
> Since you're dispatching on x and y, it doesn't really make sense (to me
> ;) to assign default values to them. Testing for missing-ness of z would
> I think have to rely on NA / NULL or other sentinel.
> Martin

Andreas Borg
Medizinische Informatik

der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz

Telefon +49 (0) 6131 175062

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.

______________________________________________ mailing list
Received on Fri 11 Mar 2011 - 15:23:57 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 Fri 11 Mar 2011 - 18:30:29 GMT.

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

list of date sections of archive