title: How to merge table and match names for column with multiple factors
body: <p>I want to merge these two tables but couldn't find a better way to do it. Normally if I use merge it would have to have at least one column matching each other...</p>
  
  <pre><code>data&lt;-data.frame(A=c("A1","A2","A3","A4"),B=c("13131,256","12141","256","684"))
     A         B
  1 A1 13131,256 
  2 A2     12141
  3 A3       256
  4 A4       684
  </code></pre>
  
  <p>and I want to merge column B according to the table below:</p>
  
  <pre><code>BNAME&lt;-data.frame(NAME=c("Red","Green","Yellow","Black"),B=c("13131","256","12141","684"))
      NAME     B
  1    Red 13131
  2  Green   256
  3 Yellow 12141
  4  Black   684
  </code></pre>
  
  <p>so the final format should look like:</p>
  
  <pre><code>  A         B      NAME
  1 A1 13131,256 Red,Green
  2 A2     12141    Yellow
  3 A3       256     Green
  4 A4       684     Black
  </code></pre>
  
  <p>Is there a fast way to get this done?</p>
  
  <p>Thanks a lot!!</p>
  
  <p>Linp</p>