title: Vector transformation based on another vector
body: <p>I have two vectors. The first one has the value that I want to study, the second one indicates the index where the value should be. Let's take an example, I have two vectors as follow:</p>
  
  <pre><code>a = c(1,2,2,1,2)
  b = c(9,10)
  </code></pre>
  
  <p>I would like to transform vector a into a vector like this:</p>
  
  <pre><code>a = c(9,10,10,9,10)
  </code></pre>
  
  <p>Can somebody help please?</p>