title: How to uniquely flag duplicate rows in R?
body: <p>I want to try to uniquely flag the a dataset (df) based on duplicate observations on certain rows. As an example: </p>
  
  <pre><code>
   ID      Name1     Name2      Name3     Name4    Name5
     1       abc       NA         rr       def      NA
     2       AA        NA         NA       NA       NA
     3       abc       NA         rr       def      NA
     5       rty       NA         NA       NA       NA
     6       rty       NA         NA       NA       NA
     7       rty       NA         NA       NA       NA
  </code></pre>
  
  <p>but I want a dataset that flags the identical rows based on names 1 through 5  and removes unique rows as follows</p>
  
  <pre class="lang-r prettyprint-override"><code>
   ID      Name1     Name2      Name3     Name4    Name5    Flag
     1       abc       NA         rr       def      NA       a
     3       abc       NA         rr       def      NA       a
     5       rty       NA         NA       NA       NA       b
     6       rty       NA         NA       NA       NA       b
     7       rty       NA         NA       NA       NA       b
  
  </code></pre>
  
  <p>So far I have done this: </p>
  
  <pre class="lang-r prettyprint-override"><code>duplicated(df[c(-1)])|duplicated(df[c(-1)]
  </code></pre>
  
  <p>but this only does not flag the duplicate columns.</p>
  
  <p>Thank you so much!</p>