原因:

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的更多相关文章

  1. 【mysql】 load local data infield 报错 ERROR 1148 (42000): The used command is not allowed with this MySQL version

    mysql> load data local infile '/Users/flint/learn/mysql/pet' into table bx_pet; 执行报错 ERROR 1148 ( ...

  2. php源码安装执行configure报错error: off_t undefined; check your library configuration

    php安装执行configure报错error: off_t undefined; check your library configuration vim /etc/ld.so.conf 添加如下几 ...

  3. linux使用wkhtmltopdf报错error while loading shared libraries:

    官网提示 linux需要这些动态库.depends on: zlib, fontconfig, freetype, X11 libs (libX11, libXext, libXrender) 在li ...

  4. 发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store

    发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store 昨晚上传项目到AppStore,报了这个错,纳尼! ...

  5. mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法

    1. 问题背景         InnoDB是新版MySQL(v5.5及以后)默认的存储引擎,之前版本的默认引擎为MyISAM,因此,低于5.5版本的mysql配置文件.my.cnf中,关于InnoD ...

  6. 运行yum报错Error: Cannot retrieve metalink for reposit

    http://www.netpc.com.cn/593.html 运行yum报错Error: Cannot retrieve metalink for reposit 今天给Centos通过rpm - ...

  7. 转:运行yum报错Error: Cannot retrieve metalink for reposit

    http://www.netpc.com.cn/593.html 运行yum报错Error: Cannot retrieve metalink for repository: epel. Please ...

  8. 在使用 Git pull 时候报错 error: inflate

    在使用 Git pull 时候报错 error: inflate 具体的错误是 这样的 error: inflate: data stream error (unknown compression m ...

  9. go报错unimplemented: 64-bit mode not compiled in与mingw 64位安装报错ERROR res已解决

    问题一:cc1.exe: sorry, unimplemented: 64-bit mode not compiled in 参考:https://www.cnblogs.com/lesroad/p/ ...

随机推荐

  1. android调试debug快捷键

       1. [Ctrl+Shift+B]:在当前行设置断点或取消设置的断点.    2. [F11]:调试最后一次执行的程序.    3. [Ctrl+F11]:运行最后一次执行的程序.    4. ...

  2. 通过ifrmae异步下载文档

    //通过ifrmae异步下载文档 function iframeGetFile(opts) { var defaultOpts = { filePath: '', onload: function ( ...

  3. div+css模拟select下拉框

    <!DOCTYPE html><html ><head lang="zh"> <meta http-equiv="Content ...

  4. 单位换算 M、Mb、MB

    硬盘单位和存储单位 硬盘单位 存储空间 K M G   Kb Mb Gb  1k =1000 bytes  1m = 1000000 bytes 1g = 1000000000 bytes   1kb ...

  5. for循环内嵌套finally使用的意外获得

    在for循环中有continue和break,无论执行continue还是break   finally的逻辑都会执行,原本以为是不执行的 格式 for (int i = 0; i < 3; i ...

  6. 实验二:klee处理未建模函数和处理error的方式

    首先,能够分析klee源码固然重要.但是目前尚未到那个地步.我按照我的过程,记录和分析我所做的实验. 结论性内容是: 1.klee处理printf传入符号值的情形时,报为error,不会将符号值具体化 ...

  7. 6.servlet和jsp的区别

    servlet和jsp的区别 jsp作为Servlet技术的扩展,经常会有人将jsp和Servlet搞混.本文,将为大家带来servlet和jsp的区别,希望对大家有所帮助. servlet和jsp的 ...

  8. SQL Server ->> 条件筛选做法之 -- IN(VALUE1,VALUE2,...)与INNER JOIN STRING_SPLIT()性能对比

    在以逗号拼接而成的字符串,传入给IN字句的元素字符串中包涵了1400多个元素 两种做法分别为 AND e.ssPfCityId IN ( SELECT CAST(value AS INT) FROM ...

  9. MySQL案例07:MySQL5.7并发复制隐式bug

    我们MySQL线上环境大部分使用的是5.7.18的版本,这个版本已修复了很多bug,但针对主从复制的bug还是有很多的,尤其是一些组复制.并行复制的bug尤为突出,在5.7.19版本有做相应改善和修复 ...

  10. 【C语言】 任意十进制数字转十六进制

    大概思路:输入任意十进制数字 首先确定位数: 使用整形数组来存储十六进制数: a[0] 表示十六进制数字的位数: #include <stdio.h> #include <stdli ...