title: ggplot2 : Plot mean with geom_bar
body: <p>I have the following data frame:</p>
  
  <pre><code>test2 &lt;- data.frame(groups = c(rep("group1",4), rep("group2",4)), 
      X2 = c(rnorm(4), rnorm(4)) , 
      label = c(rep(1,2),rep(2,2),rep(1,2),rep(2,2)))
  </code></pre>
  
  <p>and I am plotting the bar graphs for each label per group using:</p>
  
  <pre><code>ggplot(test2, aes(label, X2, fill=as.factor(groups))) + 
      geom_bar(position="dodge", stat="identity")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/0pSPr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0pSPr.png" alt="enter image description here"></a></p>
  
  <p>However, I am cannot seem to be able to find a <code>stat="mean"</code> so I can plot the means on each bar graph instead of the identity.</p>
  
  <p>Thanks for any help.</p>