title: Count number of same elements in the same position in two vectors
body: <p>I have two vectors:</p>
  
  <pre><code>set.seed(12)
  
  a&lt;-sample(c(0,1),10,replace=T)
  
  b&lt;-sample(c(0,1),10,replace=T)
  
  &gt; a
   [1] 0 1 1 0 0 0 0 1 0 0
  &gt; b
   [1] 0 1 0 0 0 0 0 1 1 0
  </code></pre>
  
  <p>I would like to count the number of elements which match in the two vectors.</p>
  
  <p>So in the above case:</p>
  
  <p>the following elements match: 1,2,4,5,6,7,8,10.</p>
  
  <p>I cannot do this with set operators because I'm not interested in the common elements, but also in their position.</p>