I have a three dimensional array, myarray
myarray<- array(dim=c(4,6,5))
and a matrix, mymatrix
> mymatrix
Bias TS PC H F FAR
red 1.0 1.0 1 1.0 0.00 0.00000
orange 1.0 1.0 1 1.0 0.00 0.00000
yellow 0.5 0.5 1 0.5 0.00 0.00000
medium 1.0 1.0 1 1.0 0.25 0.00037
Now I want to assign mymatrix as one of the element in myarray. So I am doing the following
> myarray[,,1]<-mymatrix
> myarray[,,1]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.0 1.0 1 1.0 0.00 0.00000
[2,] 1.0 1.0 1 1.0 0.00 0.00000
[3,] 0.5 0.5 1 0.5 0.00 0.00000
[4,] 1.0 1.0 1 1.0 0.25 0.00037
But my problem is that I want to have the column and row names assigned to the array (from my matrix)as well. How can I do it?
See Question&Answers more detail:os