title: Coerce character variable into numeric without warnings
body: <p>I'm fairly new to R and I'm encountering a problem in one of my functions. I want to convert three of the columns in a data.frame from character to numeric. They are mostly made up of numbers with a few "Not Available" entries scattered throughout. I am aware of these, and I want them coerced to NAs without seeing the warning, so I'm using the <code>suppressWarnings()</code> function.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>suppressWarnings(class(dataframe[,2]) &lt;- "numeric")
  suppressWarnings(class(dataframe[,3]) &lt;- "numeric")
  suppressWarnings(class(dataframe[,4]) &lt;- "numeric")
  print(apply(dataframe,2,class))
  </code></pre>
  
  <p>My issue is that the result that gets printed is: </p>
  
  <pre><code>          1           2           3           4 
  "character" "character" "character" "character" 
  </code></pre>
  
  <p>So it doesn't seem to be changing the class! Why is this? </p>
  
  <p>When I do it without suppressing the warnings, like this:</p>
  
  <pre><code>  class(dataframe[,2]) &lt;- "numeric"
    class(dataframe[,3]) &lt;- "numeric"
    class(dataframe[,4]) &lt;- "numeric"
    print(apply(dataframe,2,class))
  </code></pre>
  
  <p>I get the same output, but with the warning message: </p>
  
  <pre><code>          1           2           3           4 
  "character" "character" "character" "character" 
  Warning messages:
  1: In class(dataframe[, 2]) &lt;- "numeric" : NAs introduced by coercion
  2: In class(dataframe[, 3]) &lt;- "numeric" : NAs introduced by coercion
  3: In class(dataframe[, 4]) &lt;- "numeric" : NAs introduced by coercion
  </code></pre>
  
  <p>So it's not the warning suppression that's the problem. It must be the <code>apply()</code> function, but I can't figure out why it would display the classes incorrectly.</p>
  
  <p>Any advice or assistance would be appreciated!</p>