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]]
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.
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 reason. baptiste On 8 September 2010 17:22, Alaios <alaios at yahoo.com> 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. >