[R] question about matrix

Gabor Grothendieck ggrothendieck at myway.com
Thu Nov 13 05:37:05 CET 2003



You could consider storing your data in 3d array.

If A and B are your matrices of first and second 
numbers, respectively, with both being of the same
shape, then:

   C <- array(c(A,B), dim=c(dim(A),2))

gives you a 3d array.  For example, 

   C[,,1] is A
   C[,,2] is B
   C[2,1,] is the the vector: c(A[2,1],B[2,1])

---
Date: Wed, 12 Nov 2003 11:41:17 -0600 (CST) 
From: Mikyoung Jun <jun at galton.uchicago.edu>
To: <r-help at stat.math.ethz.ch> 
Subject: [R] question about matrix 

 
 
Hello,

I have a few questions about matrix in R. 

Can we make a matrix whose elements are list? I would like to save two
different values in each elements of matrix. If there is a package or
something which can deal with complex numbers, that will do it too. Also,
I am wondering whether there is a function to calculate the rank of the
matrix. I found a matrix package, but it doesn't have functions like that.

Thanks a lot in advance!

Mikyoung Jun

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list