title: How to compare rows with each other in a dataframe in R
body: <p>I have a dataframe <code>final_matrix</code> generated from all permutation without replacement of <code>8</code>.</p>
  
  <pre class="lang-r prettyprint-override"><code>require(tidyverse)
  require(gtools)
  
  set.seed(222)
  
  x &lt;- 0:7
  
  totale &lt;- permutations(8,8,0:7, repeats.allowed = F)
  
  final_matrix &lt;- as.data.frame(sample_n(as_tibble(totale), 120, replace = F))
  </code></pre>
  
  <p>I would be sure that each row is different so I'm trying to write a loop that check each row with other so <code>1 vs 2, 1 vs 3... and then 2 vs 3 ...</code> The comparing function is:</p>
  
  <pre><code>isTRUE(all.equal(prova%&gt;% slice(#rownumber), prova %&gt;% slice(#rownumber)))
  </code></pre>
  
  <p>All nested loops that I've tried haven't worked, how can I do?</p>