Skip to content
Prev 54399 / 63424 Next

binary form of is() contradicts its unary form

On 29 November 2017 at 21:45, Herv? Pag?s <hpages at fredhutch.org> wrote:
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