r - Error when plotting HoltWinters graph -
the following r code giving me error when trying plot holtwinters graph done here:
# init x x11()  # data mydata = read.csv("lookup.csv", header=true, stringsasfactors=false)  # data post-proc mydata = as.data.frame(mydata) mydata$time = as.posixlt(mydata$time, format='%d.%m.%y %h:%m:%s')  # create time series - hourly data -> 8765 hours/year datatimeseries <- ts(mydata$close, frequency=8765)  dataforecasts = holtwinters(datatimeseries, beta=false, gamma=false)  # output plot.ts(dataforecasts) message("press return continue") invisible(readlines("stdin", n=1))   the error i'm getting is:
$ rscript simple_forecast.r
error in xy.coords(x, null, log = log) :
(list) object cannot coerced type 'double'
calls: plot.ts -> plotts -> xy.coords
execution halted
i'm quite perplexed, since print(dataforecasts) prints correct data. can plot datatimeseries without problem.
lookup.csv (pastebin)
generally 1 should rely upon r dispatch of class-dependent functions, , notice example cited @ avril coghlan's page used plot, not plot.ts. 
 (m <- holtwinters(co2))  plot.ts(m) error in xy.coords(x, null, log = log) :    (list) object cannot coerced type 'double'   plot(m) # success      
Comments
Post a Comment