title: How to Find difference between two values of last two dates in R program
body: <pre><code>DF2
  Date         EMMI      ACT      NO2
  2011/02/12   12345     21       11
  2011/02/14   43211     22       12
  2011/02/19   12345     21       13
  2011/02/23   43211     13       12
  2011/02/23   56341     13       12
  2011/03/03   56431     18       20 
  </code></pre>
  
  <p>I need to find difference between two dates in a column. For example difference between ACT column values.For example, the EMMI 12345, Difference between dates 2011/02/19 - 2011/02/12 = 21-21 = 0. like that i want to do for entire column of ACT. Add a new column diff and add values to that. Can anybody let me know please how to do it.  </p>
  
  <p>This is the output i want</p>
  
  <pre><code>DF3
  Date         EMMI      ACT      NO2  DifACT
  2011/02/12   12345     21       11    NA
  2011/02/14   43211     22       12    NA
  2011/02/19   12345     21       13    0
  2011/02/23   43211     13       12    -9
  2011/02/23   56341     13       12    5
  </code></pre>