Error: hchart for forecast does not working for my Data

I am trying to plot forecast data with the help of hchart. But while running, it is giving an error:

Error in if (type == "heatmap") { : argument is of length zero

How could i plot "Output" based on given "Code"?

Code:

library(zoo)
library(forecast)

data<-c(1050,1200,1010,900,1100,1050,1100,1080,1180,1130,1450,1050,1300,1100,1050,900,1200,1050,1280,1100,1320,1150,1400)
data_ts<-zoo(data,seq(from = as.Date("2018-05-01"),to = as.Date("2018-05-23"),by=1))
data_ts_hw<-HoltWinters(data_ts,beta = F,gamma = F)
f<-forecast:::forecast.HoltWinters(data_ts_hw,h=3)
f<-as.data.frame(f)
f<-cbind(rownames(f),f)
rownames(f)<- NULL
colnames(f)<- c("Date","Data","Lo","Hi")
f$Date<-as.Date(as.numeric(levels(f$Date))[f$Date])

Output :

        Date     Data       Lo       Hi       NA       NA
1 2018-05-24 1199.087 1017.020 1381.155 920.6391 1477.535
2 2018-05-25 1199.087 1014.401 1383.774 916.6339 1481.541
3 2018-05-26 1199.087 1011.819 1386.356 912.6847 1485.490
rhighcharts

Answers

comments powered by Disqus