title: How to save the difference between the two rows while saving it in the same data.frame in R?
body: <p>I would like to compute the difference of each row of <code>Variable X</code> and save it as a separate <code>Variable Diff</code> in the same <code>data.frame</code>. I know its going to give me the dimension error- I want the first row of <code>Diff</code> be left <code>blank</code> and have the rest of values beneath the <code>blank</code> row under <code>Diff</code></p>
  <pre><code>library(tidyverse)
  
  set.seed(1500)
  DF &lt;- data.frame(A = runif(10,5,20), X = runif(10,100,200))
  DF$Diff &lt;- diff(DF$X)
  </code></pre>