title: Dividing numbers within the same variable in R
body: <p>I'm trying to divide two numbers within the same column and create a new column with that figure in RStudio. Let's say my data is:</p>
  
  <pre><code>year &lt;- c(2016, 2017, 2018, 2019, 2010)
  age_group &lt;- "16-17"
  total &lt;- c(915617, 917840, 923740, 929412, 933487)
  df &lt;- data.frame(year, age_group, total)
  </code></pre>
  
  <p>So my data would look like this:</p>
  
  <pre><code>Year    age_group     total
  2016    16-17         915617
  2017    16-17         917840
  2018    16-17         923740
  2019    16-17         929412
  2020    16-17         933487
  </code></pre>
  
  <p>Essentially I'm trying to divide each of the 'total' figures from 2017, 2018, 2019 and 2020 by the original 2016 'total' figure to calculate a percent change from the baseline, with the percent change showing up in another column. I know this requires the <code>mutate</code> function but beyond that I'm lost. Any help would be excellent</p>