title: Using the ns() function from the splines package inside glm()
body: <p>I'm trying to use the <code>ns()</code> function from the <strong>splines</strong> package with a poisson GLM I am using to test for significance of particulate matter concentration (<code>pm.lag0</code>) on health outcomes (<code>Freq</code>):</p>
  
  <pre><code>   &gt; gfit4 = glm(Freq ~ pm.lag0 + ns(date, df=2), family = poisson(), 
                   data = dt,  offset = log(pop))
  </code></pre>
  
  <p>I get these errors back:</p>
  
  <pre><code>Error in splineDesign(knots, x, ord, derivs, outer.ok = outer.ok) : 
    must have at least 'ord' knots
  In addition: Warning message:
  In sort(as.numeric(knots)) : NAs introduced by coercion
  </code></pre>
  
  <p>Is that not a valid use of <code>ns()</code>? Can someone help me decode this error message? The splines documentation that R provides doesn't seem to match this error (<code>?ns</code>).  </p>