Combining forecasts into a data frame in R and then exporting into excel
<p>I'm currently running multiple <code>auto.arima()</code> forecasts in R to generate a series of point forecasts with confidence intervals that I'd like to be able to pull directly into excel. A sample of the script I've currently been using below is shown for a portion of my data.</p>

<pre><code>require(forecast)


# Customer GM ARIMA Forecasts (1 Quarter Ahead)

F1 &lt;- read.csv("C:/datapath/Desktop/dataname.csv")

F1 &lt;- ts(F1, frequency = 12, start = c(2014, 1), end = c(2015, 12))

Coonan &lt;- F1[,3]
Gallo  &lt;- F1[,4]
Kempton&lt;- F1[,5]
Moore  &lt;- F1[,6]
Nekic  &lt;- F1[,7]


fit.Coonan  &lt;- auto.arima(Coonan, stepwise = FALSE)
fc.Coonan   &lt;- forecast(fit.Coonan, h=3, level = c(20, 40, 80))

fit.Gallo   &lt;- auto.arima(Gallo, stepwise = FALSE)
fc.Gallo    &lt;- forecast(fit.Gallo, h=3, level = c(20, 40, 80))

fit.Kempton &lt;- auto.arima(Kempton, stepwise = FALSE)
fc.Kempton  &lt;- forecast(fit.Kempton, h=3, level = c(20, 40, 80))

fit.Kempton &lt;- auto.arima(Kempton, stepwise = FALSE)
fc.Kempton  &lt;- forecast(fit.Kempton, h=3, level = c(20, 40, 80))

fit.Moore   &lt;- auto.arima(Moore, stepwise = FALSE)
fc.Moore    &lt;- forecast(fit.Moore, h=3, level = c(20, 40, 80))

fit.Nekic   &lt;- auto.arima(Nekic, stepwise = FALSE)
fc.Nekic    &lt;- forecast(fit.Nekic, h=3, level = c(20, 40, 80))



# Save to clipboard to copy and paste into excel

write.excel &lt;- function(x,row.names=TRUE,col.names=TRUE,...) {
  write.table(x,"clipboard",sep="\t",row.names=row.names,col.names=col.names,...)
}

write.excel(fc.Coonan)   # Then can paste Coonan Forecasts Directly into excel
</code></pre>

<p>After pasting my result into excel I get a table that looks like this this (I'd like to shift over column names, but that's not a big problem right now).
<a href="https://i.stack.imgur.com/B73Jk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B73Jk.png" alt="enter image description here"></a></p>

<p>As currently written I need to manually change the name of the model in the bottom function, run the function (in order to save the results to the clipboard), and then copy and paste the results into excel. This process has become very time consuming and I'm wondering if there's a simple way to combine my series of point forecasts and confidence intervals into one data frame that I can then export all at once into excel.</p>

<p>Thank you for any help.</p>