[R] mean and sd of each serial position

Ben Bolker ben at eno.Princeton.EDU
Fri Oct 16 20:28:46 CEST 1998


 I think "apply" is what you're looking for ...

apply(rbind(a1,a2,a3),2,mean)
apply(rbind(a1,a2,a3),2,sd)


or making it into a function:

tmpf _ function(...) {
  x _ rbind(...)
  list(mean=apply(x,2,mean),sd=apply(x,2,sd))
}


  

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