title: How do I count the number of matches that have the same position between two vectors?
body: <p>I am trying to count the number of matches between two vectors: <code>c(1,2,1)</code> and <code>c(2,2,2)</code> with the goal of returning <code>1</code>. only the second position matches between both vectors. Every solution I come up with has a loop in it though. Can someone suggest an R function to do this, rather than a loop?</p>