[R] dim vs length for vectors

Arne Henningsen ahenningsen at email.uni-kiel.de
Fri Jan 21 12:01:59 CET 2005


On Friday 21 January 2005 06:35, Gabor Grothendieck wrote:
> In R, vectors are not arrays:
>
> R> v <- 1:4
> R> dim(v)
> NULL
> R> is.array(v)
> [1] FALSE
>
> R> a <- array(1:4)
> R> dim(a)
> [1] 4
> R> is.array(a)
> [1] TRUE

Is this a feature which is useful in some applications?
IMHO the difference between vectors and 1-dimensional arrays is really 
annoying and I had already several bugs in my code, because I mixed these up.
Is it possible in future versions of R that R does not differentiate between 
vectors and 1-dimensional arrays (e.g. by treating all vectors as 
1-dimensional arrays)?

Arne




More information about the R-help mailing list