[R] mean and array

Huntsinger, Reid reid_huntsinger at merck.com
Tue Jul 2 15:48:05 CEST 2002


In general this is what "apply" does. In your example you could use
rowMeans(ar) as well, I think.

Reid Huntsinger

-----Original Message-----
From: Olivier Martin [mailto:olivier.martin at inrialpes.fr]
Sent: Tuesday, July 02, 2002 10:55 AM
To: r-help
Subject: [R] mean and array


Hi all,

I have an array, one say ar, with 3 dimensions.
dim(ar)
 >200   3   4
I would like to calculate the mean on the third dimension.
mean(ar[1,1,]),mean(ar[1,2,]) etc..., mean[200,3,].

How can i do this ?

Thanks

-- 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
Olivier MARTIN
PhD student                  phone : (33) 04 76 61 53 55
Projet IS2                               06 08 67 93 42		
INRIA Rhone-Alpes            fax   : (33) 04 76 61 54 77
655, Av. de l'Europe
Montbonnot                   e-mail: olivier.martin at inrialpes.fr
38334 Saint Ismier cedex     web   :
http://www.inrialpes.fr/is2/people/omartin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list