title: How I can remove multiple repeated rows in R
body: <p>I have a database with 100 rows. Here is a small sample of data</p>
  <pre><code>df&lt;-read.table (text=&quot; Id   Colour  Class   val Group
  'P' 'NA'    'NA'    'NA'    '1'
  'Q' 'NA'    'NA'    'NA'    '2'
  '12'    'Red'   'A' '12'    '3'
  'P' 'NA'    'NA'    'NA'    '1'
  'Q' 'NA'    'NA'    'NA'    '2'
  'Z' 'Yellow'    'M' '9' '20'
  'P' 'Blue'  'M' '30'    '50'
  
  
      &quot;, header=TRUE)
  </code></pre>
  <p>As you can see rows P and Q are repeated. I want to remove rows P and Q at the bottom to get this outcome</p>
  <pre><code>   Id Colour Class val Group
      1  P   &lt;NA&gt;  &lt;NA&gt;  NA     1
      2  Q   &lt;NA&gt;  &lt;NA&gt;  NA     2
      3 12    Red     A  12     3
      6  Z Yellow     M   9    20
      7  P   Blue     M  30    50
  </code></pre>
  <p>Using the following codes, I can get the outcome. However, this does not help me as the Id names are sometimes different and it is also tedious to check the rows of interest to remove. Can we do better?</p>
  <pre><code>df[-c(4,5), ]
  </code></pre>