title: Error while calculating accuracy of a timeseries model in R (Error in NextMethod(.Generic) : (list) object cannot be coerced to type 'double')
body: <p>With this code:</p>
  
  <pre><code>#plotting time series from year 1998 to 2008 
      year.time_series &lt;- ts(t_AMOUNT,start = c(1998) , frequency = 12 ) #Monthly 12
      plot(year.time_series)
  #splitting the timeseries for further model evaluation 
      train &lt;- window(year.timeseries, start=1998,end=2005)
      test &lt;- window(year.timeseries, start=2005, end=2008)
  
  #using models to check the accuracy results
      etsfit &lt;- ets(train)
      summary(etsfit)
  
      plot(train, main="ETS Forecast", ylab = "ets(training set)", cex.lab = 1.5, cex.main = 1.5, cex.axis = 1.5)
      lines(etsfit$fitted, col="orange")
  
  #forecast
      forecast.ets &lt;- forecast(etsfit, h=24)
      summary(forecast.ets)
      plot(forecast.ets)
  
      plot(forecast.ets, main = "2 Year Forecast Using ETS Model",
           xlim = c(1998, 2008), cex.lab = 1.5, cex.main = 1.5, cex.axis = 1.5)
      lines(test, col="red")
  
      library(Metrics)
  #input = forecast values, actual values
      accuracy(forecast.ets,test)
  </code></pre>
  
  <p>I am getting the following error at <code>accuracy(forecast.ets,test)</code>:</p>
  
  <blockquote>
    <p>Error in NextMethod(.Generic) :<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(list) object cannot be coerced to type 'double'</p>
    
    <p>In addition: Warning message:<br>
    In <code>!=.default</code>(actual, predicted) :<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longer object length is not a multiple of shorter object length</p>
  </blockquote>
  
  <p>Is there a way to split a time series and calculate it's accuracy?</p>