我想向数组中添加一个矩阵.
databox<-matrix(1:30998*21,30998, 21)
resultemptybox <- array(rep(NA,30998*21*100), dim = c(30998, 21, 99))
resultemptybox[[1]] <- databox # I would like to add databox on the first dim of resultemptybox
resultbox1 <- array(c(databox,resultemptybox), dim = c(30998,21,100))
但是str()显示,
str(resultbox1)
List of 65095800
也没有关于Resultemptybox第一暗部分的数据.
提前谢谢你,
update
感谢 comments ,我想添加更多关于我想要产生的数据和输出的细节.
以下是我的示例数据.
databox <- matrix(1:2*3,2,3)
resultemptybox <- array(rep(NA,2*3*3), dim = c(2,3,2))
我想要产生的输出是
> resultbox
, , 1
[,1] [,2] [,3]
[1,] 3 3 3
[2,] 6 6 6
, , 2
[,1] [,2] [,3]
[1,] NA NA NA
[2,] NA NA NA
, , 3
[,1] [,2] [,3]
[1,] NA NA NA
[2,] NA NA NA