R语言学习-问题解决-Error in `[<-.ts`(`*tmp*`,...only replacement of elements is allowed

在处理时间序列数据时,遇到Error in `[<-.ts`(*tmp*)...的错误,原因是时间序列带有时间属性。为消除时间属性,通过as.numeric()函数将时间序列转换为数值。
摘要由CSDN通过智能技术生成

在输出时间序列结果的时候,出现以下问题:

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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值