[R] 3D array

From: threshold <rkozar_at_interia.pl>
Date: Mon, 3 Dec 2007 16:24:41 -0800 (PST)

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.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 04 Dec 2007 - 00:37:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Dec 2007 - 15:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.