array3<-array(c(vector1,vector2,vector3,
vector4),dim=c(3,3,2),
dimnames=list(c("r1","r2","r3"),
c("cl1","cl2",
"cl3"),c("matrix1","matraix2")
))
this the array i have created ,
, , matrix1
cl1 cl2 cl3
r1 5 10 13
r2 9 11 14
r3 3 12 15
, , matraix2
cl1 cl2 cl3
r1 9 6 3
r2 1 0 14
r3 0 11 1
and this is result ,
Hear in matrix 2 , instead of row names r1,r2,r3 , i wanted to have r4,r5,r6 similarly for columns to
cl4,cl5,cl6
Hi, I'm reasonably certain that each entry of dimnames must be of length no greater than the corresponding entry of dim. With that in mind, can you do what you need to do with a list of matrices?
I just used the vector 1:18 as data because I don't know what vector1, vector2, vector3, and vector4 were in your code (I can infer it from the output, but that's a bit hard for me to do).