[Rd] binary form of is() contradicts its unary form

Suzen, Mehmet mehmet.suzen at gmail.com
Thu Nov 30 03:14:49 CET 2017


On 29 November 2017 at 21:45, Hervé Pagès <hpages at fredhutch.org> wrote:
> You're missing the point of my original post. Which is that
> there is a serious inconsistency between the unary and binary
> forms of is(). Maybe the binary form is right in case of

My understanding is that there is no inconsistency. `is` does what it
claims, from the documentation:

‘is’: With two arguments, tests whether ‘object’ can be treated as
          from ‘class2’.

          With one argument, returns all the super-classes of this
          object's class.

Important verb there is 'can be treated as from' with two arguments. So,
one can not treat `data.frame` as from 'list' class in a simple sense,
even though it inherits
from list. The complication is that list is a Primitive and this is
not coming from a
clean S4 hierarchy c.f, your A, B example.

Also, strictly speaking, having super-classes resolved does not
automatically qualify an
assumption that the object can be treated as a class of one of its
super-classes.

Cheers,
Mehmet



More information about the R-devel mailing list