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.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.