z <- apply(y, 2, mean)

Cheers,

Simon.

>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
>
>______________________________________________
>[email protected] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Visiting Fellow
School of Botany & Zoology
The Australian National University
Canberra ACT 0200
Australia

T: +61 2 6125 8057  email: [EMAIL PROTECTED]
F: +61 2 6125 5573

CRICOS Provider # 00120C
        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to