Dear All, I want to test whether a method exists for given object. For example, whether a function "deviance" is defined for an object of the "lm" class.
My imperfect understanding leads me to think something like hasMethod("deviance", object) hasMethod("deviance", "lm") existsMethod("deviance", signature(class="lm")) or similar might work (I don't fully understand how to manipulate signatures), but all the variations on this I have tried return FALSE. (Except, interestingly, when I first load library lme4, after which all return TRUE even for non-existant classes and functions). I realize there are several ways in which R implements function polymorphism and that this is all documented somewhere but a hint would save me considerable time. I would also prefer not to resort to the hack solution of try()ing the function with the object and then catching the error to determine whether it was defined. Thanks, Will =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dr William Valdar ++44 (0)1865 287 589 Wellcome Trust Centre [EMAIL PROTECTED] for Human Genetics, Oxford www.well.ox.ac.uk/~valdar ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.