title: R programming: How to convert a vector of characters to a vector of variable names
body: <p>R programming question:</p>
  
  <p>I have a question about how to convert a vector of characters to a vector of variable names (which are already assigned to numbers).</p>
  
  <p>Here is a trivial example.</p>
  
  <p>Lets say I've defined the following variables:</p>
  
  <blockquote>
    <p>a=1;b=2;</p>
  </blockquote>
  
  <p>Now, if I type in</p>
  
  <blockquote>
    <p>x=c(a,a,b)
    I'm setting x to the vector
    1,1,2</p>
  </blockquote>
  
  <p>Now lets say I have a vector made up of characters: </p>
  
  <blockquote>
    <p>y=c('a','a','b')</p>
  </blockquote>
  
  <p>How can I convert the characters in vector y to variables, which I have already defined? I.e. what can I do, so that I can convert the character vector 'a','a','b' to the vector 1,1,2 (since I set a=1, and b=2) ?</p>
  
  <p>Thanks in advance!</p>