在输出时间序列结果的时候,出现以下问题:
for (n in 0:99)
{
salesTS <-ts(src_dat$rate_m[(1+24*n):(24*n+24)],frequency=12,start=c(2015,1,1))
salesForecasts<- HoltWinters(salesTS)
salesForecast2<- forecast:::forecast.HoltWinters(salesForecasts,h=12)
output <- rbind(output,data.frame(prd_code=src_dat$prod_no[(1+24*n)],year="2017",month=seq(1:12),rate=salesForecast2$mean) )
}
Error in `[<-.ts`(`*tmp*`, ri, value = c(2.7110254334953, 2.95418132827278, :
only replacement of elements is allowed
提示rbind的时候出错,分别查看rbind两端的数据
> output
prd_code year month rate
1 13213798874 2017 1 2.711025
2 13213798874 2017 2 2.954181
3 13213798874 2017 3 2.561491
4 13213798874 2017 4