You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the root cause it that, doParallelMC calls mclapply directly, which create an extra environmnet and thus failed to execute. minimal example:
f=function(x)x+ONE
g=function(y){
ONE=1 # here, ONE is assigned in g's environment, not the global environment
f(y) # here, f would search ONE firstly in its closure, and then search it directly in the global environment, thus it could not found `ONE` which is defined in g's environment.
}
g(1) # could not found ONE
y=1
eval(body(g)) # we could solve the question by eval body here.
Should there be some document about this thing?
The text was updated successfully, but these errors were encountered:
the following code return the correct result
but if we change
parallel::makeForkCluster(2)
to2
, it generate an error,Error in { : task 1 failed - "object 'ONE' not found"
the root cause it that,
doParallelMC
callsmclapply
directly, which create an extra environmnet and thus failed to execute. minimal example:Should there be some document about this thing?
The text was updated successfully, but these errors were encountered: