[R] Understanding S4 method dispatch

Hadley Wickham h.wickham at gmail.com
Wed Aug 14 18:54:56 CEST 2013


On Wed, Aug 14, 2013 at 11:36 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
> Because the signature is always (A,A) or (B,B). Then, as in AB we have A and B and no relationship between A and B, R chooses the method lexicographically. The result is as expected: f for A is chosen.

It's not as expected, because it doesn't give a message. From ?Methods:

If there is no best match, the selection is ambiguous and a message is
printed noting which method was selected (the first method
lexicographically in the ordering) and what other methods could have
been selected.

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/



More information about the R-help mailing list