title: R - split string with 2 delimiters, remove duplicate and put the frame back?
body: <p>I have the following dataframe (df1):</p>
  
  <pre><code>someName    someMOD someValue   someID  someSymbol
  FGR8    A(P);A(Z);M(O),A(Z),P(L)    4234    1   X
  MZ66    C(P),M(O);M(O),A(Z),P(L)    434 23  Y
  O161    A(P);A(Z);M(O),A(Z),P(L)    23  32  Z
  O001    A(P),A(Z);M(O),A(P);M(O)    5   5   W
  O0019   Z(P);A(Z),M(O),A(Z),Z(P)    34345   3   K
  </code></pre>
  
  <p>I would like to split the someMOD column by ',' and then ';'    ...then remove the duplicated values and put the string back together with a comma.
  I think first we will use unlist with strsplit and then again with the semi-colon separator, then remove duplicates but how to put it back with commas?</p>
  
  <pre><code>semicolony &lt;-  unlist(strsplit(df1$someMOD,','))
  commay &lt;- unlist(strsplit(semicolony$someMOD,';'))
  commay &lt;- commay[!duplicated(commay[,1]),]
  commay = paste(commay, collapse=',')
  </code></pre>
  
  <p>Desired output</p>
  
  <pre><code>someName    someMOD someValue   someID  someSymbol
  FGR8    A(P),A(Z),M(O),P(L) 4234    1   X
  MZ66    C(P),M(O),A(Z),P(L) 434 23  Y
  O161    A(P),A(Z),M(O),P(L) 23  32  Z
  O001    A(P),A(Z),M(O)  5   5   W
  O0019   Z(P),A(Z),M(O)  34345   3   K
  </code></pre>
  
  <p>Any help is really appreciated.</p>