This is as documented on the help page for Ops (the page in base, not
the one in Methods) which is linked from ?"|". For background you
should also read the reference on that help page.
You are wrong in asserting that the internal method is 'for logicals':
please do study the help page. It covers e.g. integer vectors which
is what I suspect you have here (assuming this is something to do with
package 'bit', unmentioned).
On Mon, 28 Dec 2009, Jens Oehlschlägel wrote:
I have defined boolean methods for bit and bitwhich objects, for example
|.bit <- function(e1,e2)
and
|.bitwhich <- function(e1,e2)
Both methods coerce their arguments to the respective class, however
if I do something like
bit_obj | bitwhich_obj
then I get a warning
Warning message:
Incompatible methods ("|.bit", "|.bitwhich") for "|"
and none of the two methods is called. Instead the (internal) method
for logicals seems to be called - not even coercing its arguments to
logical. Same problem with Ops.bit and Ops.bitwhich .
What is the recommended way to get my methods reliably dispatched?
They are! Take a look at what classes in R itself have S3 Ops methods
and how they achieve what you seem to want via class inheritance.
Jens Oehlschlägel
______________________________________________
[email protected] 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.
--
Brian D. Ripley, [email protected]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
[email protected] 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.