title: Remove duplicates in string
body: <p>I have the following data set</p>
  
  <pre><code>df &lt;- data.frame(
      path = c("a,b,a", 
          "(direct) / (none),   (direct) / (none), google / cpc,    google / cpc", 
          "f,d", 
          "a,c"
      ) 
  )
  </code></pre>
  
  <p>and I wish to remove the duplicated so that my output will be </p>
  
  <pre><code>                                                                       path
  1:                                                                     a, b
  2:                                       (direct) / (none),     google / cpc
  3:                                                                     f, d
  4:                                                                     a, c
  </code></pre>
  
  <p>I tried this but it does not work for the second row</p>
  
  <pre><code>setDT(df)
  
  df$path &lt;- sapply(strsplit(as.character(df$path ), split=","), function(x) {
      paste(unique(x), collapse = ', ')
  })
  </code></pre>