title: Why is stat = "identity" necessary in geom_bar in ggplot?
body: <p>From <a href="https://stackoverflow.com/questions/59008219/how-to-plot-dates-as-dates-not-numbers-or-character-on-x-axis-of-ggplot">this</a> question we see a simple <code>geom_line</code> in the answer. </p>
  
  <pre><code>library(dplyr)
  BactData %&gt;% filter(year(Date) == 2017) %&gt;% 
    ggplot(aes(Date, Svartediket_CB )) + geom_line()
  </code></pre>
  
  <p>If we change <code>geom_line</code> to <code>geom_bar</code> we may expect to see a bar plot, but instead</p>
  
  <blockquote>
    <p>Error: stat_count() must not be used with a y aesthetic.</p>
  </blockquote>
  
  <p>But it works if we add <code>stat = "identity"</code>, like so</p>
  
  <pre><code>library(dplyr)
  BactData %&gt;% filter(year(Date) == 2017) %&gt;% 
    ggplot(aes(Date, Svartediket_CB )) + geom_bar(stat = "identity")
  </code></pre>
  
  <p>Why doesn't <code>geom_bar</code> work without <code>stat = "identity"</code> - i.e. what is the purpose of <code>stat = "identity"</code>?</p>