[R] How to?

Yves Gauvreau cyg at sympatico.ca
Thu Aug 24 16:13:05 CEST 2000


Hi,

Is there a way to apply a function to rows or columns of a matrix?

Now I use apply(as.matrix(1:nrow(m), 1, function(x) mean(m[x,])) which works
fine but kind of slow on large matrix. I'm sure there is something on this
somewhere but I can't find it.

Thanks

Yves Gauvreau

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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