1

(Mac 上で) parallel パッケージから mclapply を使用しようとしていますが、問題が発生しています。関数 edge.loop を次のように定義しました。

edge.loop <- function(index) {
   hw.edge <- E(G)[HW.edges][index]
   apath <- E(G)$emig.route[[hw.edge]]
   short.cut <- apath[is.in.graph(G, apath, what="edges")]
   Edata <- get.data.frame(G, what="edges")
   lag.surv <- 1; # initialize
   x.surv <- 1
   result_list <- vector("list",length(short.cut))
   for (x in short.cut) {
      if ( E(G)[x]$cum.path.surv == -1 ) {
        if ( E(G)[x]$int.dam.type!=0 ) {
          x.surv <- 0
          if (E(G)[x]$up.passage==1) {
            x.surv <- lag.surv*E(G)[x]$Sentrain*S.Impinge 
          }
          result_list[x] <- x.surv
          lag.surv <- x.surv                                                                          
        }         
      } 
      else lag.surv <- E(G)[x]$cum.path.surv
    }    
  return(list("short.cut" = short.cut, "x.surv" = result_list))
}

この関数を次のように呼び出すと、

x <- edge.loop(1)

それはうまくいきますが、試してみると

x <- lapply(1:2, edge.loop)

また

x <- mclapply(1:2, edge.loop)

読み取りエラーが発生する

Error during wrapup: object 'X' not found.

何が起こっているのか分かりますか?前もって感謝します!

4

0 に答える 0