[R] Matrixes inside matrixes

Patrick Burns pburns at pburns.seanet.com
Wed Sep 8 19:00:14 CEST 2010


To add to Erik's answer:

You can use a three dimensional array
if all of your data for one cell is the
same type -- numeric presumably.

If the data were different types (numeric
and character, say), you could have a
matrix of mode list to do that.  However,
that's unlikely to be worth the hassle.

'S Poetry' (found on www.burns-stat.com)
has a chapter on arrays that might be of
interest if you are using 3D arrays.  I
think all of that chapter should apply to
R as well.

On 08/09/2010 16:27, Erik Iverson wrote:
> Hello,
>
> from ?array
>
> An array in R can have one, two or more dimensions. It is simply
> a vector which is stored with additional attributes giving the
> dimensions (attribute ‘"dim"’) and optionally names for those
> dimensions (attribute ‘"dimnames"’).
>
> A two-dimensional array is the same thing as a ‘matrix’.
>
>
> So, to answer your question, "yes".
>
> Alaios wrote:
>> Hello everyone,
>>
>> Could you please help me find out if R supports matrixes inside matrixes?
>> This is what I would like to do
>>
>> I have an area map of humidity per km. I would like at every cell to
>> keep also information about the height of this area, the current
>> temperature etc.
>>
>> Is something like that supported?
>>
>> I would like to thank you in advance for your help
>>
>> Best Regards
>> Alex
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')



More information about the R-help mailing list