title: Issues finding percent change between values
body: <p>I have the following data frame:</p>
  <pre><code>df&lt;- structure(list(Group.1 = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 
  3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 
  6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 
  10, 10, 10, 10, 10, 10), species = c(&quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, 
  &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, 
  &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, 
  &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, 
  &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, 
  &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, 
  &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, &quot;GSF&quot;, &quot;CCF&quot;, &quot;BLC&quot;, &quot;BLG&quot;, &quot;LMB&quot;, &quot;RSF&quot;, 
  &quot;GSF&quot;, &quot;CCF&quot;), values = c(72.2343402025878, 1937.03733692026, 
  623.838638214881, 174.419716477824, 12.3049226613653, 2.895855065589, 
  37.3321018704224, 935.439181611622, 298.304837910605, 92.7749414559832, 
  5.49833383606564, 1.70727510450712, 23.6566247165478, 597.966655653905, 
  220.745420709475, 53.765944830084, 3.7897932631262, 1.05347148538598, 
  15.8942359026861, 454.165172018186, 148.573525029039, 39.4075327404161, 
  2.80118066589066, 0.889178275811525, 11.7014228325682, 342.66358744176, 
  117.532778999925, 29.8761721691445, 1.95309425402833, 0.623954928025089, 
  10.2405988565389, 267.872477176734, 95.5525373175992, 22.7819723416179, 
  1.59375454536288, 0.486342316189338, 8.12750074644614, 210.566179254588, 
  73.7051782364627, 18.750461871616, 1.41145646104497, 0.397612482117296, 
  7.14018246550655, 191.420750094594, 62.4641473433447, 16.179045656704, 
  1.08732558991936, 0.314392014172493, 5.71225405584123, 162.986379338076, 
  56.0946790420074, 13.8012802889254, 0.959386008911135, 0.258095053602248, 
  4.65575331835703, 129.557048689593, 45.1406344140552, 11.8447584407366, 
  0.813656130711877, 0.22946385972495)), row.names = c(NA, -60L
  ), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
  </code></pre>
  <p>I am trying to find the percent change across species, by Group.1. If I understand the use of <code>lead</code> and <code>lag</code> correctly, I should be using <code>lag</code> given that my Group.1 column is in numerical order. The final product should have Na's for all of group 1 because that's the starting group and there's no change between group 1 and itself.
  Group 2 should be the difference between group 1 &amp; 2. Group 3= change between group 2 &amp; 3 and so on...</p>
  <p>After looking at few different posts I tried a few variations of:</p>
  <pre><code>test_new&lt;- df %&gt;% 
    group_by(Group.1, species) %&gt;% 
    mutate(percent_change= (values/lag(values)-1)*100)
  </code></pre>
  <p>But this returns NAs for all the values. Anyone know where I'm going wrong?</p>