title: In R, how to add the fitted value column to the original dataframe?
body: <p>I have a multiple regression model.  I want to add the fitted values and residuals to the original <code>data.frame</code> as two new columns.  How can I achieve that?  My model in R is like this:</p>
  
  <pre><code>BD_lm &lt;- lm(y ~ x1+x2+x3+x4+x5+x6, data=BD)
  summary(BD)
  </code></pre>
  
  <p>I also got the fitted value</p>
  
  <pre><code>BD_fit&lt;-fitted(BD_lm)
  </code></pre>
  
  <p>But I want to add this <code>BD_fit</code> values as a column to my original data <code>BD</code>. I don't know how. When I tried to call <code>BD_fit</code>, it just gave me a lot of numbers. I am running a large dataset, so it is hard to list all of them here.</p>