title: Match the items in column in one dataframe and replace with the corresponding item from another dataframe
body: <p>I have dataframe <code>mydf</code> with two columns <code>LeftGenes</code> and <code>RightGenes</code>. I have another dataframe <code>mydf2</code> . I want to match item in mydf columns (if multiple, they are separated by ':') with the accession column in mydf2 and replace with the corresponding gene_id and get the result.</p>
  
  <pre><code>mydf &lt;-structure(c("NP_570602", "NA", "NA", "XP_006719119:NR_040112", 
  "NA", "NA", "NM_000662:NM_001160170:NM_001160171", "NA"), .Dim = c(4L, 
  2L), .Dimnames = list(NULL, c("LeftGenes", "RightGenes")))
  
  mydf2&lt;-structure(list(gene_id = c("1", "1", "2", "2", "2", "2", "3", 
      "9", "9", "9"), accession = c("NM_130786", "NP_570602", "NM_000014", 
      "NP_000005", "XM_006719056", "XP_006719119", "NR_040112", "NM_000662", 
      "NM_001160170", "NM_001160171")), .Names = c("gene_id", "accession"
      ), row.names = c(NA, 10L), class = "data.frame")
  </code></pre>
  
  <p>result</p>
  
  <pre><code>  LeftGenes      RightGenes
  1   1               NA
  2   NA              NA
  3   NA              9:9:9
  4   2:3             NA 
  </code></pre>