mark at myatt.demon.co.uk
Fri May 11 10:32:31 CEST 2001
luca laghi <llaghi at foodsci.unibo.it> writes:
>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?
apply(mat, 2, mean)
The '2' indicates columns. You can specify arguments to the applied
apply(mat, 2, mean, na.rm = TRUE)
I hope that helps.
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