title: Total of group_by summarize values
body: <p>I have data and a plot like the example I give below.</p>
  
  <p>I'd like to have a third "Condition" that is the Total Sum of Amount for Condition A and Condition B for a given Year and Month. I don't know how to do that since Condition is included in the <code>group_by</code> statement. In particular, I'd like to be able to plot it on the same plot as what appears below (so there'd be a third line for each Year showing the Total).</p>
  
  <pre><code>library(ggplot2)
  library(dplyr)
  data &lt;- data.frame(Amount = sample(1:100, replace=T), 
                 Condition = sample(c("A","B"), 100, replace=T),
                 Year = sample(2015:2017, 100, replace=T),
                 Month = sample(1:12, 100, replace=T))
  dataGrouped &lt;- data %&gt;%
                 group_by(Year, Month, Condition) %&gt;%
                 summarize(sumAmount = sum(Amount))
  ggplot(dataGrouped, aes(x=Month, y=sumAmount, color=factor(Year), linetype=Condition)) + 
      geom_line(size=1) + scale_x_continuous(breaks = 1:12)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jt1L8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jt1L8.png" alt="enter image description here"></a></p>
  
  <p>I've considered first doing a <code>group_by(Year, Month)</code>, then adding a Total, but still not sure what way would be best to do this (or if there's a better alternative).</p>