[R] 3D array

threshold rkozar at interia.pl
Tue Dec 4 01:24:41 CET 2007


Hi, I deal with 3D array say:

, , 1

     [,1] [,2] [,3] [,4] [,5]
[1,]    1    4    7   10   13
[2,]    2    5    8   11   14
[3,]    3    6    9   12   15

, , 2

     [,1] [,2] [,3] [,4] [,5]
[1,]   16   19   22   25   28
[2,]   17   20   23   26   29
[3,]   18   21   24   27   30

, , 3

     [,1] [,2] [,3] [,4] [,5]
[1,]   31   34   37   40   43
[2,]   32   35   38   41   44
[3,]   33   36   39   42   45

I want to calculate means in the cells with respect to dimention 3rd so for
example (1+16+31)/3 or (15+30+45)/3  AND avoid taking zeros into account.

I did it with a loop but I guess there is the other more straightforward
method. will be very grateful for help...

best, rob
-- 
View this message in context: http://www.nabble.com/3D-array-tf4940356.html#a14142187
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list