I'm trying to use the dplyr package to apply a function to all columns in a data.frame that are not being grouped, which I would do with aggregate():
aggregate(. ~ Species, data = iris, mean)
where mean is applied to all columns not used for grouping. (Yes, I know I can use aggregate, but I'm trying to understand dplyr.)
I can use summarize like this:
species <- group_by(iris, Species)
summarize(species,
          Sepal.Length = mean(Sepal.Length),
          Sepal.Width = mean(Sepal.Width))
But is there a way to have mean() applied to all columns that are not grouped, similar to the . ~ notation of aggregate()? I have a data.frame with 30 columns that I want to aggregate, so writing out the individual statements is not ideal.
 
     
    