title: How to get a paired difference between values in the same dataframe column with R
body: <p>I have the following data:</p>
  <pre><code>&lt;!-- language-all: lang-r --&gt;
  
  
      library(reprex)
      set.seed(1)
      Data &lt;- data.frame(
        Y = c(rep(&quot;v1&quot;,3), rep(&quot;v2&quot;, 3)),
        X = sample(1:6)
      )
      Data
      #&gt;    Y X
      #&gt; 1 v1 1
      #&gt; 2 v1 4
      #&gt; 3 v1 3
      #&gt; 4 v2 6
      #&gt; 5 v2 2
      #&gt; 6 v2 5
  
  &lt;sup&gt;Created on 2020-09-10 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)&lt;/sup&gt;
  </code></pre>
  <p>And I want to get the paired difference between v1 and v2: 1-6, 4-2, 3-5.</p>