Dear R users
I have a 4-dimensional matrix (actually several 3d (x,y, slices)
matrices appended over time (volumes))
say, e.g. I want to z-transform the data (subtract the mean and divide
by the std-deviation)
for (slice in 1:slices) {
for (x in 1:x.dim) {
for (y in 1:y.dim) {
Hallo Christoph!
Using apply and sweep.
Both of them accept as the second argument (MARGIN) a vector which specifies the
dimension.
?apply
?sweep.
To specify the subscripts accurately I always need some trials, and to run tests, so I
cant you provide with the final solution.
Hope it helps
On Tue, 2004-07-20 at 10:54, Wolski wrote:
Hallo Christoph!
Using apply and sweep.
Both of them accept as the second argument (MARGIN) a vector which specifies the
dimension.
?apply
?sweep.
To specify the subscripts accurately I always need some trials, and to run tests, so
I cant
I think this should do:
z - apply(my.matrix, 1:3, scale)
z - aperm(z, c(2:4, 1))
Andy
From: Christoph Lehmann
Dear R users
I have a 4-dimensional matrix (actually several 3d (x,y, slices)
matrices appended over time (volumes))
say, e.g. I want to z-transform the data (subtract the