title: Finding duplicate observations of selected variables in a tibble
body: <p>I have a rather large tibble (called <code>df.tbl</code> with ~ 26k rows and 22 columns) and I want to find the "twins" of each object, i.e. each row that has the same values in column 2:7 (date:Pos). </p>
  
  <p>If I use:</p>
  
  <pre><code>inner_join(df.tbl, ~ df.tbl[i,], by = c("date", "forge", "serNum", "PinMain", "PinMainNumber", "Pos"))
  </code></pre>
  
  <p>with <code>i</code> being the row I want to check for "twins", everything is working as expected, spitting out a 2 x 22 tibble, and I can expand this using:</p>
  
  <pre><code>x &lt;- NULL
  for (i in 1:nrow(df.tbl)) {
  x[[i]] &lt;- as_vector(inner_join(df.tbl[,], 
                          df.tbl[i,], 
                          by = c("date", 
                                 "forge", 
                                 "serNum", 
                                 "PinMain", 
                                 "PinMainNumber", 
                                 "Pos")) %&gt;% 
                 select(rowNum.x) 
  }
  </code></pre>
  
  <p>to create a list containing the row numbers for each twin for each object (row).</p>
  
  <p>I cannot, however I try, use <code>map</code> to produce a similar result: </p>
  
  <pre><code>twins &lt;- map(df.tbl, ~ inner_join(df.tbl, 
                                       ., 
                                       by = c("date", 
                                              "forge", 
                                              "serNum", 
                                              "PinMain", 
                                              "PinMainNumber", 
                                              "Pos")) %&gt;% 
           select(rowNum.x) )
  </code></pre>
  
  <p>All I get is the following error:</p>
  
  <blockquote>
    <p><code>Error in UseMethod("tbl_vars") : no applicable method for 'tbl_vars' applied to an object of class "c('double', 'numeric')"</code></p>
  </blockquote>
  
  <p>How would I go about to convert the <code>for</code> loop into an equivalent using <code>map</code>?</p>
  
  <p>My original data look like this:</p>
  
  <pre><code>&gt;head(df.tbl, 3)
  # A tibble: 3 x 22
    rowNum date       forge serNum PinMain PinMainNumber Pos   FrontBack flow  Sharped SV    OP      max   min  mean
     &lt;dbl&gt; &lt;date&gt;     &lt;chr&gt; &lt;fct&gt;  &lt;fct&gt;   &lt;fct&gt;         &lt;fct&gt; &lt;fct&gt;     &lt;chr&gt; &lt;fct&gt;   &lt;fct&gt; &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1      1 2017-10-18 NA    179    Pin     1             W     F         NA    3       36237 235    77.7  55.3  64.7
  2      2 2017-10-18 NA    179    Pin     2             W     F         NA    3       36237 235    77.5  52.1  67.4
  3      3 2017-10-18 NA    179    Pin     3             W     F         NA    3       36237 235    79.5  58.6  69.0
  # ... with 7 more variables: median &lt;dbl&gt;, sd &lt;dbl&gt;, Round2 &lt;dbl&gt;, Round4 &lt;dbl&gt;, OrigData &lt;list&gt;, dataSize &lt;int&gt;,
  #   fileName &lt;chr&gt;
  </code></pre>
  
  <p>and I would like a list with a length the same as nrow(df.tbl) looking like this:</p>
  
  <pre><code>&gt; twins
  [[1]]
  [1] 1 7
  
  [[2]]
  [1] 2 8
  
  [[3]]
  [1] 3 9
  </code></pre>
  
  <p>Almost all objects have one twin / duplicate (as above) but a few have two or even three duplicates (as defined above, i.e. column 2:7 are the same)</p>