From tlumley at u.washington.edu  Thu Dec 30 16:48:15 2004
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Thu Dec 30 16:48:21 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.A41.4.61b.0412300745270.11816@homer11.u.washington.edu>

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

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

Yes. They both work as documented, as you note below. People have often 
pointed out that is.vector is a slightly misleading name, and it might 
have been better if that function had been called something like 
is.bare.vector() back in the Disco Age when it was created. But it wasn't.

 	-thomas

> 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.
>
> Thanks, for any comments!
> Matthias
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle


[Rd] is.vector(...) <-> is(..., "vector")
Thomas Lumley