Re: [R] coerce vector into array - change filling sequence

2010-01-12 Thread Stephan Kolassa
Hi, you can permute array dimensions using aperm(): x <- 1 : 24 z <- array(x, dim=c(6,2,2)) y <- aperm(z,perm=c(3,2,1)) y[1,1,] HTH, Stephan Kohleth Chia schrieb: Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimen

[R] coerce vector into array - change filling sequence

2010-01-12 Thread Kohleth Chia
Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimension, then the 2nd last etc. Let's jump straight into an example. x <- 1 : 24 y <- array(dim=c(2,2,6)) I would like to have: y[1,1,1] = 1 y[1,1,2] = 2 ... y[1,1,6] = 6