title: How do I sort one vector based on values of another
body: <p>I have a vector x, that I would like to sort based on the order of values in vector y. The two vectors are not of the same length.</p>
  
  <pre><code>x &lt;- c(2, 2, 3, 4, 1, 4, 4, 3, 3)
  y &lt;- c(4, 2, 1, 3)
  </code></pre>
  
  <p>The expected result would be:</p>
  
  <pre><code>[1] 4 4 4 2 2 1 3 3 3
  </code></pre>