I have a 3-dimensional array and would like to collapse to two-dimensional by stacking one dimension in rows (combining rows of one dimension). In my code, I filled out a โworksheetโ (3rd dimension) with a 2-dimensional array for each index, and now I want to take this 3-dimensional array and collect the rows of these sheets one above the other.
Here is an example array, so I can explain what I want the final result to look like:
x <- array(1:24, dim=c(2, 3, 4),
dimnames=list(letters[1:2], LETTERS[1:3], letters[23:26]))
dim(x)
I would like to w, x, y, zwere stacked on top of each other in a two-dimensional array, which would have 8 rows and 3 columns. Here is a way to do this, which is cumbersome (and not possible in my loop):
x1<-x[,,1]
x2<-x[,,2]
x3<-x[,,3]
x4<-x[,,4]
All<-rbind(x1,x2,x3,x4)
I looked abindand adrop, but they are not quite right.
aperm, , , (?)
list ( , , ). , ?
!