Say you have two 3x4 matrices:
m1 <- matrix(rnorm(12), nrow = 3, ncol = 4)
m2 <- matrix(rnorm(12), nrow = 3, ncol = 4)
If you want to put them in an array, first create an array from NA:
A <- array(as.numeric(NA), dim = c(3,4,2))
Then fill the layers with data:
A[,,1] <- m1
A[,,2] <- m2
As suggested by @Justin, you can also just put matrices into a list:
A2 <- list()
A2[['m1']] <- m1
A2[['m2']] <- m2
: , . , , csv:
myfiles <- dir(pattern = ".csv")
for (i in 1:length(myfiles)){
A2[[myfiles[i]]] <- read.table(myfiles[i], sep = ',')
}