title: R: Using dplyr group_by with ggplot2 and changing title per group
body: <p>I have the following example dataframe <code>df_summarised</code> which in reality will have more years and Isotope data.</p>
  <pre><code>structure(list(Isotope = c(&quot;TC99M&quot;, &quot;TC99M&quot;, &quot;TC99M&quot;, &quot;TC99M&quot;, 
  &quot;TC99M&quot;, &quot;TC99M&quot;, &quot;TC99M&quot;, &quot;TC99M&quot;, &quot;TL201&quot;, &quot;TL201&quot;, &quot;TL201&quot;, 
  &quot;TL201&quot;, &quot;TL201&quot;, &quot;TL201&quot;, &quot;TL201&quot;, &quot;TL201&quot;), month = structure(c(1L, 
  2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), .Label = c(&quot;Jan&quot;, 
  &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, 
  &quot;Nov&quot;, &quot;Dec&quot;), class = c(&quot;ordered&quot;, &quot;factor&quot;)), year = c(2021, 
  2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 
  2021, 2021, 2021, 2021), TotalMonthlyExcretion = c(17705.648, 
  20717.156, 27443.508, 19528.556, 22711.792, 20083.524, 17791.076, 
  9223.8, 163.695, 738.51, 1055.775, 906.438, 482.082, 741.984, 
  605.211, 265.641), MonthlyLimits_MBq = c(80000, 80000, 80000, 
  80000, 80000, 80000, 80000, 80000, 5600, 5600, 5600, 5600, 5600, 
  5600, 5600, 5600)), .Names = c(&quot;Isotope&quot;, &quot;month&quot;, &quot;year&quot;, &quot;TotalMonthlyExcretion&quot;, 
  &quot;MonthlyLimits_MBq&quot;), row.names = c(NA, -16L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>I want to create an individual plot for each isotope, year combination and save as a separate png file. For each isotope/year pairing, I want to change the title to reflect the pairing. I have tried the following:</p>
  <pre><code>ActivityPlots &lt;- df_summarised %&gt;%
      group_by(Isotope,year) %&gt;%
      do(
         plots = ggplot(data=., aes(x=month,y=TotalMonthlyExcretion)) +
         geom_bar(stat=&quot;identity&quot;, width = .5, fill=&quot;tomato3&quot;) +
         labs(title = paste(&quot;Liquid Radioactive Waste. Year: &quot;, df_summarised$year,&quot; Isotope: &quot;, df_summarised$Isotope),
             x = &quot;Month&quot;,
             y = &quot;Total Monthly Excretion (MBq)&quot;,
             caption = paste(&quot;Year: &quot;,df_summarised$year)
             ) +
         theme_bw() +
         theme(
              plot.title = element_text(color=&quot;black&quot;, size=14, face=&quot;bold.italic&quot;),
              axis.title.x = element_text(size=14, face=&quot;bold&quot;),
              axis.title.y = element_text(size=14, face=&quot;bold&quot;))
         )
  </code></pre>
  <p>However, the plot title for each plot is the same: 'Liquid Radioactive Waste. Year 2021 Isotope TC99M'. I'm assuming this is picking up the values from the first entry of the data frame.</p>
  <p>What is the best way around this?</p>