[R] how to get the mean of each group?

From: ronggui <0034058_at_fudan.edu.cn>
Date: Sun 19 Jun 2005 - 22:57:35 EST


i have the data x.1

>x.1 <- data.frame(income=runif(100)*10000,
+ edu=sample(c('hs','col','none'),100,T),y=rnorm(100)*100)

and i want to get :

       income y

col  5526.726 -11.00956
hs   4196.036 -10.03861
none 4308.111 -28.69549

5526.726 is the mean income for col, 4196.036 is the mean income for hs......

-- 
Department of Sociology
Fudan University,Shanghai
Blog:http://sociology.yculblog.com

______________________________________________
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 Sun Jun 19 23:01:49 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:51 EST