title: How to ignore null values in R?
body: <p>I have a data set with some null values in one field. When I try to run a linear regression, it treats the integers in the field as category indicators, not numbers.</p>
  
  <p>E.g., for a field that contains no null values...</p>
  
  <pre><code>summary(lm(rank ~ num_ays, data=a)),
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>Coefficients:
               Estimate Std. Error t value Pr(&gt;|t|)    
  (Intercept) 10.607597   0.019927 532.317  &lt; 2e-16 ***
  num_ays      0.021955   0.007771   2.825  0.00473 ** 
  </code></pre>
  
  <p>But when I run the same model on a field with null values, I get:</p>
  
  <pre><code>Coefficients:
                Estimate Std. Error  t value Pr(&gt;|t|)    
  
  (Intercept)  1.225e+01  1.070e+00   11.446  &lt; 2e-16 ***
  num_azs0    -1.780e+00  1.071e+00   -1.663  0.09637 .  
  num_azs1    -1.103e+00  1.071e+00   -1.030  0.30322    
  num_azs10   -9.297e-01  1.080e+00   -0.861  0.38940    
  num_azs100   1.750e+00  5.764e+00    0.304  0.76141    
  num_azs101  -6.250e+00  4.145e+00   -1.508  0.13161    
  </code></pre>
  
  <p>What's the best and/or most efficient way to handle this, and what are the tradeoffs?</p>