title: matching and counting strings (k-mer of DNA) in R
body: <p>I have a list of strings (DNA sequence) including A,T,C,G. I want to find all matches and insert into table whose columns are all possible combination of those DNA alphabet (4^k; "k" is length of each match - K-mer - and must be specified by user) and rows represent number of matches in sequence in a list. </p>
  
  <p>Lets say my list includes 5 members:  </p>
  
  <pre><code>DNAlst&lt;-list("CAAACTGATTTT","GATGAAAGTAAAATACCG","ATTATGC","TGGA","CGCGCATCAA")
  </code></pre>
  
  <p>I want set <code>k=2</code> (2-mer) so <code>4^2=16</code> combination are available including <code>AA,AT,AC,AG,TA,TT,...</code>  </p>
  
  <p>So my table will have <code>5 rows</code> and <code>16 columns</code>. I want to count number of matches between my k-mers and list members. </p>
  
  <p>My desired result: <code>df:</code></p>
  
  <pre><code>lstMemb AA AT AC AG TA TT TC ...
    1     2  1  1  0  0  3  0
    2       ...
    3
    4
    5
  </code></pre>
  
  <p>Could you help me implement this in R?  </p>