title: How calculate growth rate in long format data frame?
body: <p>With data structured as follows...</p>
  
  <pre><code>df &lt;- data.frame(Category=c(rep("A",6),rep("B",6)),
        Year=rep(2010:2015,2),Value=1:12)
  </code></pre>
  
  <p>I'm having a tough time creating a growth rate column (by year) within category. Can anyone help with code to create something like this...</p>
  
  <pre><code>Category Year Value Growth  
      A   2010    1   
      A   2011    2   1.000  
      A   2012    3   0.500  
      A   2013    4   0.333  
      A   2014    5   0.250  
      A   2015    6   0.200  
      B   2010    7     
      B   2011    8   0.143  
      B   2012    9   0.125  
      B   2013    10  0.111  
      B   2014    11  0.100  
      B   2015    12  0.091  
  </code></pre>