Re: [R] mean

About this list Date view Thread view Subject view Author view

From: Achim Zeileis (zeileis@ci.tuwien.ac.at)
Date: Thu 10 May 2001 - 03:37:43 EST


Message-ID: <3AF98067.1EF489A6@ci.tuwien.ac.at>

luca laghi wrote:
>
> Greetings,
> a little question:
> if I heve got a matrix with 10 columns, how do I produce a 10 elements
> vector with the average of each column?

with apply()
if x is your matrix

apply(x, 2, 'mean')

Best,
Achim

> Thank you,
> Luca
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2b30 : Fri 22 Jun 2001 - 18:58:41 EST