I have two high dimensional arrays, both with 1000 rows, 3 columns, 10 slices and 4 groups of slices.
I want to bind them but matching the columns between them. Example below:
#dumb data
array1 <- array(1:4, dim = c(2,1,2,2),dimnames = list(NULL,"Ca",1:2,1:2)); array1
array2 <- array(5:8, dim = c(2,1,2,2),dimnames = list(NULL,"Cb",1:2,1:2)); array2
#desired result
cbind(array1[,,1,1],array2[,,1,1],array1[,,2,1],array2[,,2,1],
array1[,,1,2],array2[,,1,2],array1[,,2,2],array2[,,2,2])
the outcome is:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 5 3 7 1 5 3 7
[2,] 2 6 4 8 2 6 4 8
Although column names do not show up, I have ordered manually the columns to be: First column of the first array, first column of the second array, second column of the first array, second column of the second array, and so on.
Is there a other way to do this than manually using cbind?
Thanks in advance!