title: How can I replace words in a string with corresponding to the order of a vector?
body: <p>For example, I have a string:</p>
  
  <pre><code>myString &lt;- "a c b c c"
  </code></pre>
  
  <p>and a corresponding vector, it is somehow like a dictionary</p>
  
  <pre><code>mylevel &lt;- c("a", "b", "c") # Means "a" is the first one, "b" is the second, "c" is the third.
  </code></pre>
  
  <p>I want to get the new string looks like below:</p>
  
  <pre><code>"1 3 2 3 3"
  </code></pre>
  
  <p>How can I do this efficiently?</p>