[R] Ops method does not dispatch on either of two classes

Jens Oehlschlägel oehl_list at gmx.de
Mon Dec 28 15:31:40 CET 2009


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? 

Jens Oehlschlägel




More information about the R-help mailing list