Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
plyr中存在无法理解的错误:名称错误(结果)<;-名称(件):';名称';属性[11644]的长度必须与向量[11187]的长度相同_R_Debugging_Parallel Processing_Plyr - Fatal编程技术网

plyr中存在无法理解的错误:名称错误(结果)<;-名称(件):';名称';属性[11644]的长度必须与向量[11187]的长度相同

plyr中存在无法理解的错误:名称错误(结果)<;-名称(件):';名称';属性[11644]的长度必须与向量[11187]的长度相同,r,debugging,parallel-processing,plyr,R,Debugging,Parallel Processing,Plyr,我在集群上运行plyr时出错,调试时遇到困难。我在下面分享伪代码。我运行一个名为getopt的函数,该函数包装在Xgetopt中,用于处理错误。它基本上是在输入矩阵上按行进行网格搜索优化。输入矩阵为11644x2 有谁能告诉我这个错误是从哪里来的,或者是什么意思?我无法进行回溯,因为我无法在本地复制错误 > library(plyr) > library(doMC) > registerDoMC(32) > > Xgetopt = function(input){

我在集群上运行
plyr
时出错,调试时遇到困难。我在下面分享伪代码。我运行一个名为
getopt
的函数,该函数包装在
Xgetopt
中,用于处理错误。它基本上是在输入矩阵上按行进行网格搜索优化。输入矩阵为11644x2

有谁能告诉我这个错误是从哪里来的,或者是什么意思?我无法进行回溯,因为我无法在本地复制错误

> library(plyr)
> library(doMC)
> registerDoMC(32)
> 
> Xgetopt = function(input){
+   out = tryCatch(getopt(input), error=function(e) e, finally=NA)
+   if(inherits(out, "error")) {out=NA;     print("an error happened but it got handled.")}
+   return(out)
+   }
> 
> tocalc = expand.grid(ID = sort(unique(m$model$ID)), price = seq(from=0,to=100,by=2.5))
> tocalc$ID = as.character(tocalc$ID)
> out = dlply(.data=tocalc,c('ID','price'),.fun=Xgetopt,.parallel=TRUE)

[1] "an error happened but it got handled."
[1] "an error happened but it got handled."
[1] "an error happened but it got handled."

snip (only a few errors, mostly successes)

[1] "99 37.5"
Error in names(result) <- names(pieces) : 
  'names' attribute [11644] must be the same length as the vector [11187]
Calls: dlply -> llply
Execution halted
>库(plyr)
>图书馆(doMC)
>registerDoMC(32)
> 
>Xgetopt=函数(输入){
+out=tryCatch(getopt(输入),error=function(e)e,finally=NA)
+if(继承(out,“error”){out=NA;print(“发生了一个错误,但它得到了处理。”)}
+返回(输出)
+   }
> 
>tocalc=expand.grid(ID=sort(unique(m$model$ID)),price=seq(from=0,to=100,by=2.5))
>tocalc$ID=as.character(tocalc$ID)
>out=dlply(.data=tocalc,c('ID','price'),.fun=Xgetopt,.parallel=TRUE)
[1] “发生错误,但已得到处理。”
[1] “发生错误,但已得到处理。”
[1] “发生错误,但已得到处理。”
剪报(只有几个错误,大部分是成功的)
[1] "99 37.5"
名称错误(结果)llply
停止执行

尝试以下方法:将网格大小减小到更小的对象,至少有一行会产生错误。然后只在这个子集上本地运行函数,并在本地调试;似乎在某个地方您没有将每个元素都命名为。@安德烈:这很难做到,因为我不知道哪些行会生成错误,每次优化大约需要15秒——整个集合需要50小时的CPU时间。卡尔·维特霍夫:“不是每个元素都被命名吗?”当然,它们都被命名为“out”--或者至少它们应该被命名为。。。