标签:power enc net ini detail 技术 integer test bubuko
原因:
pred$mean是Time-Series类型,rbind函数不支持。通过as.double将其转换成double类型即可。
修改前代码:
all_predata_time <- data.frame(pd=0.1,Row=1,preRow=0,pt=0.1,stasid=‘1‘,InitDate=‘1‘);
all_predata_time <- all_predata_time[-1,]
stasPowerPre_Time <- function(staid){
testSrc<-......
if(nrow(testSrc)>0)
{
maxDate <- max(testSrc$bizdate)
tsd<- ts(testSrc$dp,start=c(2016,01,01),frequency=365)
str(tsd)
x <- ets(tsd)
pred <- forecast(x,h=365)
predata <- data.frame(pd = pred$mean)
predata$Row <-as.integer(row.names(predata));
predata$preRow <- predata$Row -1;
predata$pt <- as.double(c(0));
predata$stasid <- staid;
predata$InitDate <- maxDate ;
all_predata_time <<- rbind(all_predata_time,predata)
}
}
修改后代码:
all_predata_time <- data.frame(pd=0.1,Row=1,preRow=0,pt=0.1,stasid=‘1‘,InitDate=‘1‘);
all_predata_time <- all_predata_time[-1,]
stasPowerPre_Time <- function(staid){
testSrc<-......
if(nrow(testSrc)>0)
{
maxDate <- max(testSrc$bizdate)
tsd<- ts(testSrc$dp,start=c(2016,01,01),frequency=365)
str(tsd)
x <- ets(tsd)
pred <- forecast(x,h=365)
predata <- data.frame(pd = as.double(pred$mean))
predata$Row <-as.integer(row.names(predata));
predata$preRow <- predata$Row -1;
predata$pt <- as.double(c(0));
predata$stasid <- staid;
predata$InitDate <- maxDate ;
all_predata_time <<- rbind(all_predata_time,predata)
}
}
参考:https://blog.csdn.net/wlt9037/article/details/74389807
R执行报错:Error in `[<-.ts`(`*tmp*`,...only replacement of elements is allowed
标签:power enc net ini detail 技术 integer test bubuko
原文地址:https://www.cnblogs.com/xianhan/p/9516147.html