title: How to recode a variable to numeric?
body: <pre><code>&gt; library(car)
  
  &gt; df = data.frame(value=c('A', 'B', 'C', 'A'))
  &gt; foo = recode(df$value, "'A'=1; 'B'=2; 'C'=3;", as.numeric.result=TRUE)
  &gt; mean(foo)
  [1] NA
  Warning message:
  In mean.default(foo) : argument is not numeric or logical: returning NA
  &gt; foo
  [1] 1 2 3 1
  Levels: 1 2 3
  </code></pre>
  
  <p>Ugh. I thought the <a href="http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/car/html/recode.html" rel="nofollow noreferrer">definition of as.numeric.result</a> (default TRUE) was that if the results are all numerals, they would be coerced to numeric.</p>
  
  <p>How do I get the results of this recoding to be numeric?</p>