[R] Matrixes inside matrixes

2010-09-08 Thread Alaios
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

Re: [R] Matrixes inside matrixes

2010-09-08 Thread Erik Iverson
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

Re: [R] Matrixes inside matrixes

2010-09-08 Thread baptiste auguie
Hi, You can have each cell of a matrix contain a matrix, but for a reason that is just not clear to me the matrices are wrapped in a list, m = matrix(replicate(4,matrix(1:9,3,3),simplify=FALSE), 2,2) m[1,2][[1]] str(m) and even more surprising to me, m itself has become a list for some

Re: [R] Matrixes inside matrixes

2010-09-08 Thread Patrick Burns
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