How to create lower dimensional matrix from higher dimensional array in R?

arrays, dimensions, matrix, r

Solution

If you have the array set up right in memory, you can just reset the dimensions and it will work.

dim(temp) <- c(100, 40)

Problem

Suppose I have an array such that: ``` temp<-array(0, dim=c(100,10,4)) ``` I can merge matrices 1 & 2 from the array into a single matrix using cbind: ``` temp.merge<-cbind(temp[,,1],temp[,,2]) ``` Is there a way to merge all n matrices (in this case 4) into a single one without having to write out the position of each one as above?

Original source