Skip to content
Prev 315397 / 398503 Next

Get a percent variable based on group

Hi,
Is it this?


aggregate(iris$Sepal.Length,by=list(iris$Species),FUN=function(x) sum(x)/sum(iris$Sepal.Length)*100)
???? Group.1??????? x
1???? setosa 28.55676
2 versicolor 33.86195
3? virginica 37.58129

A.K.