[R] variance/mean

rkevinburton at charter.net rkevinburton at charter.net
Sun Mar 22 09:17:29 CET 2009


At the risk of appearing ignorant why is the folowing true?

o <- cbind(rep(1,3),rep(2,3),rep(3,3))
var(o)
     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0
[3,]    0    0    0

and

mean(o)
[1] 2

How do I get mean to return an array similar to var? I would expect in the above example a vector of length 3 {1,2,3}.

Thank you for your help.

Kevin




More information about the R-help mailing list