title: How can I predict a single value from a linear regression in R?
body: <p>I've made a linear regression of dollar prices to GDPPC like so:</p>
  
  <pre><code>r = lm(dollar_value ~ GDPPC, prices_gdp)
  </code></pre>
  
  <p>(<code>prices_gdp</code> is a <code>data.table</code>, if that matters).</p>
  
  <p>I can now easily generate a bunch of values based on a <code>data.table</code> using <code>predict</code>. But what I want to do (in order to plot a <code>geom_abline</code> on a chart) is calculate the dollar value when GDPPC is zero, and get that back as a number—something <em>like</em></p>
  
  <pre><code>predict(r, 0)
  </code></pre>
  
  <p>This gives me an error: <code>Error in eval(predvars, data, env): object 'GDPPC' not found</code>. Is there any way of doing this short of creating a new dummy <code>data.table</code> with GDPPC=0 as its only row, feeding it in, and then pulling the number out?</p>