[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 that supported?

I would like to thank you in advance for your help

Best Regards
Alex



  
[[alternative HTML version deleted]]

__
R-help@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.


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 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@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@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.


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 reason.

baptiste



On 8 September 2010 17:22, Alaios ala...@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@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@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.


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 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@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@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
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

__
R-help@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.