title: Remove duplicate rows with certain value in specific column
body: <p>I have a data frame and I want to remove rows that are duplicated in all columns except one column and choose to keep the ones that are not certain values.</p>
  
  <p><a href="https://i.stack.imgur.com/laEbi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/laEbi.png" alt="enter image description here"></a></p>
  
  <p>In above example, 3rd row and 4th row are duplicated for all columns except for col3, so I want to keep one row only. The complicated step is I want to keep 4th row instead of 3rd because 3rd row in col3 is "excluded". In general, I want to only keep the rows(that were duplicated) that do not have "excluded". </p>
  
  <p>My real data frame have lots of duplicated rows and among those 2 rows that are duplicated, one of them is "excluded" for sure.</p>
  
  <p>Below is re-producible ex:</p>
  
  <pre><code>a &lt;- c(1,2,3,3,7)
  b &lt;- c(4,5,6,6,8)
  c &lt;- c("red","green","excluded","orange","excluded")
  d &lt;- data.frame(a,b,c)
  </code></pre>
  
  <p>Thank you so much!</p>
  
  <p>Update: Or, when removing duplicate, only keep the second observation (4th row). </p>