R-alpha: is.vector of one-dimensional array

Paul Gilbert pgilbert@bank-banque-canada.ca
Fri, 5 Dec 1997 09:50:47 -0500


>is.vector() of an one-dimensional array returns FALSE. this is also the
>behavior of Splus, but totally counter-intuitive for me ... IMO an
>array of dimension 1 is exactly the definition of a vector ...

I assume by "one-dimensional array" you mean a two or higher dimensional array
with all but one of the values from dim(x)  being 1. This is possibly
counter-intuitive, but there are cases where one needs to distinguish these.
Perhaps length(dim(x)) would be better, but dim returns NULL  for a vector. This
is even more counter-intuitive to me. I think it should return length(x) for a
vector. In any case there is lots of code out there that will break if you
change these.

Paul Gilbert

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._