Skip to content

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

2 messages · Friedrich Leisch, Paul Gilbert

#
maybe we've already diskussed this before, but Kurt and I can't
remember ...

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

it also breaks our current plot.factor, which is simply a

	barplot(table(x))

table() returns an one-dimensional array, but barplot only accepts
vector and matrix arguments ...

of course one could check additionally for arrays with correct
dimension ... but ...

any opinions?

fritz

--=20
-------------------------------------------------------------------
                        Friedrich  Leisch                            =20
Institut f=FCr Statistik                      Tel: (+43 1) 58801 4541
Technische Universit=E4t Wien                 Fax: (+43 1)  504 14 98
Wiedner Hauptstra=DFe 8-10/1071      Friedrich.Leisch@ci.tuwien.ac.at
A-1040 Wien, Austria             http://www.ci.tuwien.ac.at/~leisch
     PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key
-------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._