From mehmet.suzen at gmail.com  Wed Nov 29 20:22:25 2017
From: mehmet.suzen at gmail.com (Suzen, Mehmet)
Date: Wed, 29 Nov 2017 20:22:25 +0100
Subject: [Rd] binary form of is() contradicts its unary form
In-Reply-To: <5A1EF8DB.6080401@fredhutch.org>
References: <5A1EF8DB.6080401@fredhutch.org>
Message-ID: <CAPtbhHzXe3=EBW6wwyx1Hh158qjBrC0vfFbh4+o3bRZTC+c5Kw@mail.gmail.com>

Hi Herve,

I think you are confusing subclasses and classes. There is no
contradiction. `is` documentation
is very clear:

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

Note that object class is always `data.frame` here, check:

> class(data.frame())
[1] "data.frame"
> is(data.frame(), "data.frame")
[1] TRUE

Best,
Mehmet





On 29 Nov 2017 19:13, "Herv? Pag?s" <hpages at fredhutch.org> wrote:

> Hi,
>
> The unary forms of is() and extends() report that data.frame
> extends list, oldClass, and vector:
>
>   > is(data.frame())
>   [1] "data.frame" "list"       "oldClass"   "vector"
>
>   > extends("data.frame")
>   [1] "data.frame" "list"       "oldClass"   "vector"
>
> However, the binary form of is() disagrees:
>
>   > is(data.frame(), "list")
>   [1] FALSE
>   > is(data.frame(), "oldClass")
>   [1] FALSE
>   > is(data.frame(), "vector")
>   [1] FALSE
>
> while the binary form of extends() agrees:
>
>   > extends("data.frame", "list")
>   [1] TRUE
>   > extends("data.frame", "oldClass")
>   [1] TRUE
>   > extends("data.frame", "vector")
>   [1] TRUE
>
> Who is right?
>
> Shouldn't 'is(object, class2)' be equivalent
> to 'class2 %in% is(object)'? Furthermore, is there
> any reason why 'is(object, class2)' is not implemented
> as 'class2 %in% is(object)'?
>
> Thanks,
> H.
>
> --
> Herv? Pag?s
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Canc
> <https://maps.google.com/?q=Fred+Hutchinson+Canc&entry=gmail&source=g>er
> Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages at fredhutch.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



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