title: How to predict the future price of a stock per day using R?
body: <p>I am trying to predict the future stock price using auto.arima model in R. I am able to predict the results but I can not get the dates to show up with it. I only see numbers. Here is my code</p>
  
  <pre><code>library(quantmod)
  
  Stock_df&lt;-as.data.frame(getSymbols(Symbols = "AAPL", src = "yahoo", from = "2017-05-08", env = NULL))
  
  Stock_dates&lt;- as.data.frame(as.POSIXlt(rownames(Stock_df)))
  colnames(Stock_dates) &lt;- "Dates"
  
  Stock_df$Open = Stock_df[,1]
  Stock_df$High = Stock_df[,2]
  Stock_df$Low = Stock_df[,3]
  Stock_df$Close = Stock_df[,4]
  Stock_df$Volume = Stock_df[,5]
  Stock_df$Adj = Stock_df[,6]
  Stock_df &lt;- Stock_df[,c(7,8,9,10,11,12)]
  
  x &lt;- as.data.frame(xts(Stock_df$Close,Stock_dates$Date))
  fit &lt;- auto.arima(x,ic="bic")
  fit.forecast &lt;- forecast(fit)
  
  fit.forecast
  </code></pre>
  
  <p>I get the following results:</p>
  
  <pre><code>    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
  253         185.16 182.2090 188.1110 180.6468 189.6732
  254         185.16 180.9866 189.3334 178.7773 191.5427
  255         185.16 180.0487 190.2714 177.3429 192.9771
  256         185.16 179.2579 191.0621 176.1336 194.1865
  257         185.16 178.5613 191.7587 175.0681 195.2519
  258         185.16 177.9315 192.3885 174.1049 196.2151
  259         185.16 177.3523 192.9677 173.2191 197.1009
  260         185.16 176.8132 193.5068 172.3947 197.9253
  261         185.16 176.3069 194.0131 171.6203 198.6997
  262         185.16 175.8280 194.4920 170.8879 199.4321
  </code></pre>
  
  <p>I want the following results to show up</p>
  
  <pre><code>    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
  2018-05-08  185.16 182.2090 188.1110 180.6468 189.6732
  2018-05-09  185.16 180.9866 189.3334 178.7773 191.5427
  2018-05-10  185.16 180.0487 190.2714 177.3429 192.9771
  2018-05-11  185.16 179.2579 191.0621 176.1336 194.1865
  2018-05-14  185.16 178.5613 191.7587 175.0681 195.2519
  2018-05-15  185.16 177.9315 192.3885 174.1049 196.2151
  2018-05-16  185.16 177.3523 192.9677 173.2191 197.1009
  2018-05-17  185.16 176.8132 193.5068 172.3947 197.9253
  2018-05-18  185.16 176.3069 194.0131 171.6203 198.6997
  2018-05-21  185.16 175.8280 194.4920 170.8879 199.4321
  </code></pre>
  
  <p><strong>PARTIAL SOLUTION</strong></p>
  
  <p>Below is the partial solution thanks to Ryan</p>
  
  <pre><code>forecast.data&lt;- as.data.frame(fit.forecast)
  forecast.data$newcolname &lt;- Sys.Date() + seq_len(nrow(forecast.data)) - 1
  </code></pre>
  
  <p>The reason why this is partial solution is because plotting fit.forecast object provides multiple graphs. I want one graph with the time in the x axis.<a href="https://i.stack.imgur.com/qLexR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qLexR.png" alt="enter image description here"></a></p>