Aggregate funds and maintain N
I'm trying aggregate
a dataset, but I want to store the number of observations as well. So what I have looks like this:
aggregate(iris$Sepal.Length, by=list(iris$Species), FUN=mean)
But this returns an object like this:
Group.1 x
1 setosa 5.006
2 versicolor 5.936
3 virginica 6.588
when I want AND and the number of cases (rows) in each group (in a separate column)
+3
source to share