title: The as.numeric function changes the values in my dataframe
body: <p>I have a column containing speed measurements which I need to change to numeric so that I can use both the mean and sum functions. However, when I do convert them the values change substantially.</p>
  <p>Why is this?</p>
  <p>This is what my data look like at first:</p>
  <p><img src="https://i.stack.imgur.com/BBit4.png" alt="enter image description here" /></p>
  <p>And here is the structure of the data frame:</p>
  <pre><code>'data.frame':   1899571 obs. of  20 variables:
   $ pcd        : Factor w/ 1736958 levels &quot;AB101AA&quot;,&quot;AB101AB&quot;,..: 1 2 3 4 5 6 6 7 7 8 
   $ pcdstatus  : Factor w/ 5 levels &quot;Insufficient Data&quot;,..: 4 4 4 4 4 2 3 2 3 3 ...
   $ mbps2      : Factor w/ 3 levels &quot;N&quot;,&quot;N/A&quot;,&quot;Y&quot;: 2 2 2 2 2 2 2 2 2 2 ...
   $ averagesp  : Factor w/ 301 levels &quot;&gt;=30&quot;,&quot;0&quot;,&quot;0.2&quot;,..: 301 301 301 301 301 301 301 
   $ mediansp   : Factor w/ 302 levels &quot;&gt;=30&quot;,&quot;0&quot;,&quot;0.1&quot;,..: 302 302 302 302 302 302 302 
   $ maxsp      : Factor w/ 301 levels &quot;&gt;=30&quot;,&quot;0&quot;,&quot;0.2&quot;,..: 301 301 301 301 301 301 301 
   $ nga        : Factor w/ 2 levels &quot;N&quot;,&quot;Y&quot;: 1 2 1 1 1 1 1 2 2 2 ...
   $ connections: Factor w/ 119 levels &quot;&lt;3&quot;,&quot;0&quot;,&quot;1&quot;,&quot;10&quot;,..: 2 2 2 2 2 1 2 1 2 2 ...
   $ pcd2       : Factor w/ 1736958 levels &quot;AB10 1AA&quot;,&quot;AB10 1AB&quot;,..: 1 2 3 4 5 6 6 7 7 8 
   $ pcds       : Factor w/ 1736958 levels &quot;AB10 1AA&quot;,&quot;AB10 1AB&quot;,..: 1 2 3 4 5 6 6 7 7 8 
   $ oslaua     : Factor w/ 407 levels &quot;&quot;,&quot;95A&quot;,&quot;95B&quot;,..: 374 374 374 374 374 374 374 
   $ x          : int  394251 394232 394181 394251 394371 394181 394181 394331 394331 
   $ y          : int  806376 806470 806429 806376 806359 806429 806429 806530 806530 
   $ ctry       : Factor w/ 4 levels &quot;E92000001&quot;,&quot;N92000002&quot;,..: 3 3 3 3 3 3 3 3 3 3 ...
   $ hro2       : Factor w/ 13 levels &quot;&quot;,&quot;E12000001&quot;,..: 12 12 12 12 12 12 12 12 12 12 
   $ soa1       : Factor w/ 34381 levels &quot;&quot;,&quot;E01000001&quot;,..: 32485 32485 32485 32485 
   $ dzone1     : Factor w/ 6507 levels &quot;&quot;,&quot;E99999999&quot;,..: 128 128 128 128 112 128 128 
   $ soa2       : Factor w/ 7197 levels &quot;&quot;,&quot;E02000001&quot;,..: 6784 6784 6784 6784 6784 6784 
   $ urindew    : int  9 9 9 9 9 9 9 9 9 9 ...
   $ soa1ni     : Factor w/ 892 levels &quot;&quot;,&quot;95AA01S1&quot;,..: 892 892 892 892 892 892 892 892 
  </code></pre>
  <p>This is the code for converting my variables to numeric variables.</p>
  <pre><code> #convert individual columns to numeric variables  
   total$averagesp &lt;- as.numeric(total$averagesp) 
   total$mediansp &lt;- as.numeric(total$mediansp) 
   total$maxsp &lt;- as.numeric(total$maxsp) 
   total$mbps2 &lt;- as.numeric(total$mbps2)
   total$nga &lt;- as.numeric(total$nga)
   total$connections &lt;- as.numeric(total$connections)
  </code></pre>
  <p>But I have this strange output afterwards where all my data have been inflated:</p>
  <p><img src="https://i.stack.imgur.com/5u4fC.png" alt="enter image description here" /></p>
  <p>Any help would be much appreciated - thank you!</p>