title: R: Calculating the average of a subset of data
body: <p>I have a big (for me anyway) dataset in long format of 2381 rows. It contains quarterly information, here's a sample:</p>
  
  <pre><code>Year    Price   Region
  Q4 1973 7713    North
  Q1 1974 7743    North
  Q2 1974 7733    North
  Q3 1974 7862    North
  Q4 1974 7932    North
  Q1 1975 8151    North
  .
  .
  .
  Q1 2015 188566  UK
  Q2 2015 194258  UK
  Q3 2015 195733  UK
  Q4 2015 197044  UK
  Q1 2016 198564  UK
  </code></pre>
  
  <p>I want to calculate the yearly mean for each region and then plot it using ggplot2. I'm ok with the plotting, but I'm struggling to find how to automate getting the average for so many different years (there are 13 regions in total).</p>
  
  <p>Any help? </p>
  
  <p><a href="https://i.stack.imgur.com/pIfma.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pIfma.png" alt="enter image description here"></a></p>