title: How to find complementary rows in matrix in R
body: <p>I have this matrix:</p>
  
  <pre><code>      [,1] [,2] [,3] [,4]
   [1,]    1    0    0    0
   [2,]    0    1    0    0
   [3,]    0    0    1    0
   [4,]    0    0    0    1
   [5,]    1    1    0    0
   [6,]    0    0    1    1
   [7,]    1    0    1    0
   [8,]    0    1    0    1
   [9,]    1    1    1    1
  </code></pre>
  
  <p>So, there are some rows that are complementary. In this matrix these are:</p>
  
  <pre><code>[5,]    1    1    0    0
  [6,]    0    0    1    1
  </code></pre>
  
  <p>and</p>
  
  <pre><code>[7,]    1    0    1    0
  [8,]    0    1    0    1
  </code></pre>
  
  <p>What I want to do is to find these complementary rows and keep just the first one of them. The expected output should be this:</p>
  
  <pre><code>      [,1] [,2] [,3] [,4]
   [1,]    1    0    0    0
   [2,]    0    1    0    0
   [3,]    0    0    1    0
   [4,]    0    0    0    1
   [5,]    1    1    0    0
   [6,]    1    0    1    0
   [7,]    1    1    1    1
  </code></pre>
  
  <p>Is there a way to do this in R?</p>