title: How do I assign numerical values to characters in a column in R?
body: <p>I have imported a table (.cvs) in R, which has a column for income, where the income is given as either <code>&lt;=50K</code> or <code>&gt;50K</code>. </p>
  
  <pre><code>&gt;str(hausuebung_daten$income)
   chr [1:500] "&lt;=50K" "&lt;=50K" "&gt;50K" "&lt;=50K" "&gt;50K" "&lt;=50K" "&lt;=50K" "&lt;=50K" "&gt;50K" "&lt;=50K" "&gt;50K" "&gt;50K" ...
  </code></pre>
  
  <p>Now I am trying to convert this column from character to numeric. I have been able to convert it to factor</p>
  
  <pre><code>&gt; hausuebung_daten$income&lt;-factor(hausuebung_daten$income)
  &gt; str(hausuebung_daten$income)
   Factor w/ 2 levels "&lt;=50K","&gt;50K": 1 1 2 1 2 1 1 1 2 1 ...
  </code></pre>
  
  <p>And then tried assigning the factors a numerical value (using the plyr package)</p>
  
  <pre><code>library(plyr)
  &gt; hausuebung_daten$income&lt;-revalue(hausuebung_daten$income, "1"="&lt;=50000", "2"=&gt;"50000")
  Error: unexpected '&gt;' in "hausuebung_daten$income&lt;-revalue(hausuebung_daten$income, "1"="&lt;=50000", "2"=&gt;"
  </code></pre>
  
  <p>and I get the error message as shown above. </p>