[Rd] class of integers

Kurt Hornik hornik at ci.tuwien.ac.at
Wed Mar 12 17:21:01 MET 2003


>>>>> 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



More information about the R-devel mailing list