From hornik at ci.tuwien.ac.at  Wed Mar 12 17:21:01 2003
From: hornik at ci.tuwien.ac.at (Kurt Hornik)
Date: Wed Mar 12 17:23:06 2003
Subject: [Rd] class of integers
In-Reply-To: <Pine.LNX.4.51.0303121706310.30570@artemis.imbe.med.uni-erlangen.de>
References: <Pine.LNX.4.51.0303121706310.30570@artemis.imbe.med.uni-erlangen.de>
Message-ID: <15983.24173.528001.829449@mithrandir.hornik.net>

>>>>> Torsten Hothorn writes:

> Hi,

> I'm a little bit confused about the class of integers (with yesterdays
> r-devel):

R> a <- 1:10
R> class(a)
> [1] "integer"
R> inherits(a, "integer")
> [1] FALSE
R> data.class(a)
> [1] "numeric"
R> is.numeric(a)
> [1] TRUE
R> inherits(a, "numeric")
> [1] FALSE


> data.class is consistent with R-1.6.2, ok. The class of "a" is integer,
> also ok. At first: why does "inherits" state that "a" is not of class
> integer nor numeric?

You really want

R> is(a, "integer")
[1] TRUE

But note that we need to update class.Rd in base: e.g., it currently
says

     `unclass' returns (a copy of) its argument with its class
     information removed.

-k


[Rd] class of integers
Kurt Hornik