您好,aggregate是可以用sum的。问题应该出在你的数据上,我这里给你举一个用sum的例子:
attach(iris)
aggregate(iris[,-5], list(iris$Species), sum)
#Results:
# Group.1 Sepal.Length Sepal.Width Petal.Length Petal.Width
#1 setosa 250.3 171.4 73.1 12.3
#2 versicolor 296.8 138.5 213.0 66.3
#3 virginica 329.4 148.7 277.6 101.3
望采纳,谢谢!