title: Histogram of mean per bin
body: <p>I am trying to create a histogram where the bin heights are the mean of the values that fall into each bin. The code for p2 below is what I thought would work.</p>
  
  <pre><code>library(ggplot2)
  m &lt;- mtcars[1:20, ];
  p &lt;- ggplot(m, aes(x = mpg)) + geom_histogram(binwidth = 5);
  p &lt;- p + aes(weight = wt); # works, but is the sum of the wt
  p2 &lt;- p + aes(weight = wt / ..count..); # does not work, but the idea I am going for
  </code></pre>
  
  <p>Sorry if I am missing something obvious here, but I appreciate the help.</p>