From ripley at stats.ox.ac.uk  Thu Dec 30 11:57:26 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu Dec 30 11:57:30 2004
Subject: [Rd] is.vector(...) <-> is(..., "vector")
In-Reply-To: <1223.132.180.246.67.1104401390.squirrel@mail.uni-bayreuth.de>
References: <1223.132.180.246.67.1104401390.squirrel@mail.uni-bayreuth.de>
Message-ID: <Pine.LNX.4.61.0412301054240.675@gannet.stats>

On Thu, 30 Dec 2004 Matthias.Kohl@uni-bayreuth.de wrote:

> Is it intended that is.vector(...) and is(..., "vector")
> do not always give identical results?

Yes.  What makes you think they are anything to so with each other?
The S4 class "vector" is quite distinct from the usage in base R.

> is.vector() works as documented ('is.vector' returns
> 'FALSE' if 'x' has any attributes except names.)
> Thus,
>
> A <- array(1:2, 1:2)
> M <- diag(2)
>
> is.vector(M) # FALSE, as documented
> # and
> is.vector(A) # FALSE, as documented
>
> # however
> is(M, "vector") # TRUE
> is(A, "vector") # TRUE
>
> # which is also correct, since
> extends("matrix", "vector")
> extends("array", "vector")
>
> I'm working with R Version 2.0.1 Patched (2004-12-09)
> on Windows 2000.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] is.vector(...) <-> is(..., "vector")
Prof Brian Ripley