title: R diff() handling NA
body: <p>I would like to calculate the first difference in a variable if either the current value or the lag value is missing. The R diff() function returns NA if either value is missing. Can this behavior be changed?</p>
  
  <pre><code>data &lt;- c(5, NA, NA, 10, 25)
  
  diff_i_want &lt;- c(-5, NA, 10, 15)
  
  diff_i_get &lt;- diff(data)
  
  identical(diff_i_want, diff_i_get)
  </code></pre>