title: Grep lines based on identifier
body: <p>My data frame looks like this:</p>
  
  <pre><code>hsa-let-7a-3p   45
  hsa-let-7a-5p   1148
  hsa-let-7b-3p   8
  hsa-let-7b-5p   184
  hsa-let-7c-3p   1
  hsa-let-7c-5p   258
  hsa-let-7d-5p   343
  </code></pre>
  
  <p>I would like to calculate how many lines has that has both 3p and 5p for each identifier, and this that has only 3p and only 5p. For instance <code>hsa-let-7a</code> <code>hsa-let-7b</code> and <code>hsa-let-7c</code> all has both 3p and 5p. however, <code>hsa-let-7d</code> only has 5p. I don't care about the numbers behind. I would prefer a grep based solution, but R would also be nice. </p>
  
  <p>Output:</p>
  
  <pre><code>Both 3p and 5p: 3
  Only 3p: 0
  Only 5p: 1
  </code></pre>
  
  <p>My try i R:</p>
  
  <pre><code>&gt; head(Meister_Ago1,20)
  
  
               V1   V2
  1  hsa-let-7a-2-3p    1
  2    hsa-let-7a-3p   45
  3    hsa-let-7a-5p 1148
  4    hsa-let-7b-3p    8
  5    hsa-let-7b-5p  184
  6    hsa-let-7c-3p    1
  7    hsa-let-7c-5p  258
  8    hsa-let-7d-3p   22
  9    hsa-let-7d-5p  142
  10   hsa-let-7e-3p    1
  11   hsa-let-7e-5p  114
  12 hsa-let-7f-1-3p    1
  13 hsa-let-7f-2-3p   10
  14   hsa-let-7f-5p  794
  15   hsa-let-7g-3p    2
  16   hsa-let-7g-5p   94
  17   hsa-let-7i-3p    2
  18   hsa-let-7i-5p   97
  19    hsa-miR-1-3p    4
  20    hsa-miR-1-5p    0
  </code></pre>