using parallel's parLapply: unable to access variables within parallel code

后端 未结 3 1122
无人及你
无人及你 2020-12-02 13:14

I recently got a computer with several cores and am learning to use parallel computing. I\'m fairly proficient with lapply and was told parLapply

3条回答
  •  被撕碎了的回忆
    2020-12-02 13:57

    You need to export those variables to the other R processes in the cluster:

    cl <- makeCluster(mc <- getOption("cl.cores", 4))
    clusterExport(cl=cl, varlist=c("text.var", "ntv", "gc.rate", "pos"))
    

提交回复
热议问题