title: R: predict.lm() not recognizing an object
body: <pre><code>&gt; reg.len &lt;- lm(chao1.ave ~ lg.std.len, b.div) # b.div is my data frame imported from a CSV file
  &gt; reg.len
  
  Call:
  lm(formula = chao1.ave ~ lg.std.len, data = b.div)
  
  Coefficients:
  (Intercept)   lg.std.len  
        282.4       -115.7  
  
  &gt; newx &lt;- seq(0.6, 1.4, 0.01)
  &gt; prd.len &lt;- predict(reg.len, newdata=data.frame(x=newx), interval="confidence", level=0.90, type="response")
  Error in eval(expr, envir, enclos) : object 'lg.std.len' not found
  </code></pre>
  
  <p>I've tried doing the lm like this: <code>lm(b.div$chao1.ave ~ b.div$lg.std.len)</code>, but then, <code>predict()</code> gives a warnings that the newdata and variables are different lengths. So, I tried the way above, and now <code>predict()</code> gives an error saying it doesn't recognize the object.  How to fix, please?</p>