title: Adding predict output to original dataframe
body: <p>I have a dataframe that has two columns - year and admission counts. And I have the following code to predict future numbers (for the next 5 years)
  (The last year in the dataframe is 1983)</p>
  
  <pre><code>df = read.table("C:AdmCounts.txt",header=TRUE)
  colnames(df)[1] &lt;- "Year" 
  str(df)
  model &lt;- lm(AdmCount ~ Year, df)
  new.df &lt;- data.frame(Year=c(1985, 1986, 1987, 1988, 1989))
  p = predict(model, new.df)
  </code></pre>
  
  <p>The output is </p>
  
  <pre><code>       1        2        3        4        5 
  62.64909 62.74266 62.83623 62.92980 63.02337
  </code></pre>
  
  <p>How do I add the above output back to the original dataframe to plot a graph? The 1 in the output is year 1985, 2 is 1986 and so on.</p>
  
  <p>Thanks.</p>