Skip to content
Prev 17447 / 63424 Next

generic function S3 consistency warning advice

This happens because you get a primitive function. However, I believe 
Re() is already an generic function ("too") internally, so you do not 
have to create your own and redefine the default one.  (I'm not sure if 
there is another way to tell if a primitive function is also a generic 
function than to look at the C source code or by trial-and-error).

Try:

% R --vanilla
 > Re.MyClass <- function(x) NA
 > x <- structure(3, class="MyClass")
 > Re(5+3i)
5
 > Re(x)
NA

/Henrik
Robin Hankin wrote: