[R] mean
Ben Bolker
bolker at ufl.edu
Mon Jun 8 14:18:32 CEST 2009
amor Gandhi wrote:
>
> Hi,
>
> I have gote the following data
>
> x1 <- c(rep(1,6),rep(4,7),rep(6,10))
> x2 <- rnorm(length(x1),6,1)
> data <- data.frame(x1,x2)
>
> and I would like to compute the mean of the x2 for each individual of x1,
> i. e. x1=1,4 and 6?
>
You'll probably get seven answers to this, but:
tapply(x2,list(x1),mean)
--
View this message in context: http://www.nabble.com/mean-tp23922878p23922947.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list