title: How to find pairs in 2 vectors per row and count the result
body: <p>I've got a text file with 2 vectors  (I read them in as data.frame) as an example.</p>
  
  <pre><code>x =c(1,2,1,7,5,8) ; y = c(1,2,1,8,4,8)
  </code></pre>
  
  <p>Im looking to find all pairs between 2 vectors. Im currently writing to file 
  and using system call:</p>
  
  <pre><code>ans11 = system('grep "^1,1" | wc -l ') to get the result.
  </code></pre>
  
  <p>Using grep I use</p>
  
  <pre><code>'grep "^1,1" | wc -l '  and I get a result of 2
  'grep "^2,2" | wc -l '  and I get a result of 1
  'grep "^8,8" | wc -l '  and I get a result of 1
  </code></pre>
  
  <p>How do I do this with R? I would use grep and wc but there must be a way in R to do it with.</p>