title: How can I use dplyr to apply a function to all non-group_by columns?
body: <p>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 <code>aggregate()</code>:</p>
  
  <pre><code>aggregate(. ~ Species, data = iris, mean)
  </code></pre>
  
  <p>where <code>mean</code> is applied to all columns not used for grouping. (Yes, I know I can use aggregate, but I'm trying to understand dplyr.)</p>
  
  <p>I can use <code>summarize</code> like this:</p>
  
  <pre><code>species &lt;- group_by(iris, Species)
  summarize(species,
            Sepal.Length = mean(Sepal.Length),
            Sepal.Width = mean(Sepal.Width))
  </code></pre>
  
  <p>But is there a way to have <code>mean()</code> applied to <em>all</em> columns that are not grouped, similar to the <code>. ~</code> notation of <code>aggregate()</code>? I have a data.frame with 30 columns that I want to aggregate, so writing out the individual statements is not ideal.</p>