# [R] Data.frame Vs Matrix Vs Array: Definitions Please

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 27 16:15:12 CEST 2010

```On Wed, Oct 27, 2010 at 10:07 AM, Ivan Calandra
<ivan.calandra at uni-hamburg.de> wrote:
>
>
> Le 10/27/2010 15:45, Gabor Grothendieck a écrit :
>>
>> On Wed, Oct 27, 2010 at 8:38 AM, Ivan Calandra
>> <ivan.calandra at uni-hamburg.de>  wrote:
>>>
>>> What I don't understand is why vectors (with more than one value) don't
>>> have
>>> dimensions. They look like they do have 1 dimension. For me no dimension
>>> would be a scalar. Like in geometry: a point has no dimension, a line has
>>> 1,
>>> a square has 2, a cube 3 and so on. Is it because of some internal
>>> process?
>>> The intuitive geometry way of thinking is not programmatically relevant?
>>>
>> Maybe you used APL before.   The basic structure in that language is
>> an array but that is not the case for R. The basic structure for data
>> is a vector and more complex data objects are build from that.  An
>> array is a more complex object than a vector.  A 1d array is not the
>> same as a vector.  Dimensions are an additional concept unlike APL.
>
> I've never used any other language before. It's just that I compare the
> printing of an object to a geometric object, which means that a vector of
> length > 1 has 1 dimension. In my mind, as I said, a point has no dimension,
> a line has 1, a square has 2, a cube 3 and so on. But now, I kind of
> understand that in R, dimensions do not really correspond to the "shape" of
> an object, it's just an attribute. I'll then just accept that 1d array are
> not vectors and that vectors have NULL dimension (which is not zero I
> guess!)

It would be preferable to say that dimension is not a concept
associated with vectors at all.  Saying it is but its NULL makes it
seem like its still there.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

```