title: Remove duplicate observations between columns of a specific row
body: <p>This is a short example of the dataframe that I am trying to clean:</p>
  
  <pre><code>L3 &lt;- LETTERS[1:5]    
  fac&lt;-c("fish", "meat", "chicken", "veg", "shrimp")
  
  set.seed(1)
  (d &lt;- data.frame(code = sample(c(11:15)), 
        upc = sample(c(1:5)), desc = sample(fac), 
        desc1 = fac, desc2 = sample(fac), 
        desc3 = fac, desc4 = sample(fac) ))
  
  
    code upc    desc   desc1   desc2   desc3   desc4
  1   12   5    meat    fish chicken    fish  shrimp
  2   15   4    fish    meat  shrimp    meat    fish
  3   14   2 chicken chicken     veg chicken    meat
  4   13   3     veg     veg    fish     veg     veg
  5   11   1  shrimp  shrimp    meat  shrimp chicken
  </code></pre>
  
  <p>I am trying to write a <strong>general</strong> function (using a <code>for loop</code> and <code>unique()</code>) that verifies the entries from column 3 to 7 independently for each row and that keeps a unique value that is not repeated in the other columns (i.e. : if a row contains fish in all desc columns the new row should only contain fish in one column). More specifically, the desired outcome is:</p>
  
  <pre><code>  code upc    desc desc1   desc2 desc3   desc4
  1   12   5    meat  fish chicken        shrimp
  2   15   4    fish  meat  shrimp              
  3   14   2 chicken           veg          meat
  4   13   3     veg          fish              
  5   11   1  shrimp          meat       chicken
  </code></pre>
  
  <blockquote>
    <p></p>
  </blockquote>