title: How can I use mutate to find the difference between two years in one column of my dataframe?
body: <p>Hi i am new to the tidyverse in R and trying to work on a project</p>
  
  <p>My dataframe(ab):</p>
  
  <pre><code> Year       Zip     Total_Population Median_Income      City State
  1 2014      00601            18088         10833  Adjuntas    PR
  2 2014      00602            40859         16353    Aguada    PR
  3 2015      00603            53162         16323 Aguadilla    PR
  4 2015      00606             6415         14138   Maricao    PR
  5 2016      00610            28805         17265    Anasco    PR
  6 2016      00612            66251         17752   Arecibo    PR
  </code></pre>
  
  <p>I have used mutate to create population to income ratio based on zip:</p>
  
  <pre><code>dmg_ratio &lt;-  ab %&gt;% filter(Year %in% c(2014,2015,2016,2017)) %&gt;% 
    group_by(Zip) %&gt;%
    mutate(Poptoincomeratio = Total_Population/Median_Income)
  
  dmg_ratio
  </code></pre>
  
  <p>Output repex:</p>
  
  <pre><code>Year Zip           Total_Population Median_Income City      State Poptoincomeratio
   2014 ZCTA5 00601            18088         10833 Adjuntas    PR               1.67 
   2014 ZCTA5 00602            40859         16353 Aguada      PR               2.50 
   2015 ZCTA5 00601            53162         16323 Adjuntas    PR               3.26 
  </code></pre>
  
  <p>I want to find the difference in this newly created mutation(Poptoincomeratio) from 2014 to 2016 per zip code to understand if there has been any change in the population to income ratio over the years.
  How would I be able to do this?</p>