title: How to subset data with advance string matching
body: <p>I have the following data frame from which I would like to extract rows based on matching strings.</p>
  
  <pre><code>&gt; GEMA_EO5
  gene_symbol  fold_EO  p_value                           RefSeq_ID      BH_p_value
         KNG1 3.433049 8.56e-28              NM_000893,NM_001102416    1.234245e-24
        REXO4 3.245317 1.78e-27                           NM_020385    2.281367e-24
        VPS29 3.827665 2.22e-25                 NM_057180,NM_016226    2.560770e-22
      CYP51A1 3.363149 5.95e-25              NM_000786,NM_001146152    6.239386e-22
        TNPO2 4.707600 1.60e-23 NM_001136195,NM_001136196,NM_013433    1.538000e-20
        NSDHL 2.703922 6.74e-23              NM_001129765,NM_015922    5.980454e-20
       DPYSL2 5.097382 1.29e-22                           NM_001386    1.062868e-19
  </code></pre>
  
  <p>So I would like to extract e.g. two rows based on matching strings in $RefSeq_ID, that works fine with the following:</p>
  
  <pre><code>&gt; list&lt;-c("NM_001386", "NM_020385")
  &gt; GEMA_EO6&lt;-subset(GEMA_EO5, GEMA_EO5$RefSeq_ID %in% list, drop = TRUE)
  
  &gt; GEMA_EO6
  
  gene_symbol  fold_EO  p_value RefSeq_ID    BH_p_value
        REXO4 3.245317 1.78e-27 NM_020385  2.281367e-24
       DPYSL2 5.097382 1.29e-22 NM_001386  1.062868e-19
  </code></pre>
  
  <p>But some of the rows have several RefSeq_IDs separated with commas, so I am looking for a general way of telling if $RefSeq_ID contains a certain string pattern and then subset that row.</p>