Displaying 1 result from an estimated 1 matches for "transposexyinxyz".
2009 May 15
2
transposing/rotating XY in a 3D array
...I have the same order as in the data files.
Now I am using an ad-hoc function (see below) to transpose back the
rotated YX into a XYZ array, but I'd rather go with built-ins, e.g.
byrow=T, or t() -- and also without duplicating my data.
THanks for the advice in advance.
Gabor
<code>
transposeXYinXYZ<-function(x){
y <- array(NA,c(dim(x)[2],dim(x)[1],dim(x)[3]))
for(i in 1:dim(x)[3]){
y[,,i] <- t(x[,,i])
}
return (y)
}
xyz <- array(1:24,c(4,3,2))
yxz <- transpose(x)
xyz
yxz
</code>