title: Forecast with data series with quantmod and forecast package
body: <p>I'm new to ts, and xts object. </p>
  
  <p>When dealing with time series data, I encountered the problem</p>
  
  <pre><code>require(quantmod)
  require(forecast)
  ticker &lt;- "^GSPC"
  getSymbols(ticker, src="yahoo", to = "2013-12-31")
  prices &lt;- GSPC[,6]  # First get data using package quantmod
  # then forecasting using package forecast
  prices.ts &lt;- as.ts(prices)
  prices.ets &lt;- ets(prices.ts)
  prices.fore &lt;- forecast(prices.ets, h=10)
  # then plot
  plot(prices.fore, xaxt = "n")
  </code></pre>
  
  <p>My problems are :</p>
  
  <p>1 . When I tried to save the GSPC with date in a csv file. I searched and tried this</p>
  
  <p><code>write.zoo((GSPC, file = "GSPC.csv", sep = ",", qmethod = "double"))</code></p>
  
  <p>The error message: <code>Error: unexpected ',' in "write.zoo((GSPC,"</code> , I checked the syntax, it seems to be correct, and I tried other combinations. All failed with the similar error message. </p>
  
  <p>also I tried <code>index(GSPC)</code> to get the date.</p>
  
  <p>and then <code>cbind(index(GSPC), GSPC[, 6])</code>. It also failed..</p>
  
  <p>Error message: <code>Error in merge.xts(..., all = all, fill = fill, suffixes = suffixes) : 
    dims [product 1762] do not match the length of object [3524]</code></p>
  
  <p>but when I checked the length</p>
  
  <pre><code>&gt; length(GSPC[,6])
  [1] 1762
  &gt; length(index(GSPC))
  [1] 1762
  </code></pre>
  
  <p>2 . the plot is like this</p>
  
  <p><img src="https://i.stack.imgur.com/QgZcg.png" alt="enter image description here"></p>
  
  <p>there's no x-lab and y- lab. I tried the methods of accepted answer posted <a href="https://stackoverflow.com/questions/10302261/forecasting-time-series-data">here</a>, . but failed. </p>
  
  <p>Especially, I don't get the purpose of the following code. It seems to change the appearance of the plot, but it doesn't change the appearance at all. I don't know whether I lose some points. </p>
  
  <pre><code>a = seq(as.Date("2011-11-01"), by="weeks", length=11)
  axis(1, at = decimal_date(a), labels = format(a, "%Y %b %d"), cex.axis=0.6)
  abline(v = decimal_date(a), col='grey', lwd=0.5)
  </code></pre>
  
  <p>Also, I want to plot from as.Date("2013-01-01").</p>
  
  <p>Could you please give some suggestions? </p>
  
  <p>Thanks a lot!</p>