b=data.frame(Math=c(502,600,412,358,495,512,410,625,573,522),Science=c(95,99,80,82,75,85,80,95,89,86),English=c(25,22,18,15,20,28,15,30,27,18),Students=c("John Davis","Angela Williams","Bullwinkle Moose","David Jones","Janice Markhammer","Cheryl Cushing","Reuven Ytzrhak","Greg Knox","Joel England","Mary Rayburn"))
b
b.mean=aggregate(cbind(Math,Science,English),data=a,FUN="mean")
b.mean
输出:
> b.mean
Students Math Science English
1 Angela Williams 600 99 22
2 Bullwinkle Moose 412 80 18
3 Cheryl Cushing 512 85 28
4 David Jones 358 82 15
5 Greg Knox 625 95 30
6 Janice Markhammer 495 75 20
7 Joel England 573 89 27
8 John Davis 502 95 25
9 Mary Rayburn 522 86 18
10 Reuven Ytzrhak 410 80 15
为什么没有各个科目的均值啊...谢谢!!!