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!
Andreas
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
UNIVERSITÄTSMEDIZIN
der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz
www.imbei.uni-mainz.de
Telefon +49 (0) 6131 175062
E-Mail: b...@imbei.uni-mainz.de
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.
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel