[R] Calculate Mean of Column Vectors?

From: Thomas Hopper <thopper106035_at_comcast.net>
Date: Tue 11 Jan 2005 - 14:45:56 EST


Hello,

I've got an array defined as y <- rnorm(3000), dim(y) <- c(3, 1000).

I'd like to produce a 1000-element vector z that is the mean of the corresponding elements of y (like z[1,1] <- mean(y[1,1], y[2,1], y[3,1])), but being new to R, I'm not sure how to do this for all elements at once (or, at least, simply). Any help is appreciated.

Thanks,

Tom



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jan 11 13:56:50 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 01:24:40 EST