title: Obtain the indexes of one vector into another vector but keeping the order
body: <p>Let us say I have two vectors a, and b, </p>
  
  <pre><code>a = c(1,21,3,42,5,6,7,8,9)
  b = c(2,5,7,10,3,40,1,21,42,6,8,9)
  </code></pre>
  
  <p>If I do:</p>
  
  <pre><code>which(b %in% a)
  </code></pre>
  
  <p>I obtain,</p>
  
  <pre><code> 2  3  5  7  8  9 10 11 12
  </code></pre>
  
  <p>But I'd like to keep the order in which they appear, i.e., I'd like to have as the output,</p>
  
  <pre><code>7 8 5 9 2 10 3 11 12
  </code></pre>
  
  <p>since 1 is in position 7 in b, 21 is in position 8 in b, etc.</p>
  
  <p>Is that easy to do?</p>