By default clusterExport
looks in the .GlobalEnv
for objects to export that are named in varlist
. If your objects are not in the .GlobalEnv
, you must tell clusterExport
in which environment it can find those objects.
You can change your clusterExport
to the following (which I didn't test, but you said works in the comments)
clusterExport(cl=cl, varlist=c("text.var", "ntv", "gc.rate", "pos"), envir=environment())
This way, it will look in the function's environment for the objects to export.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…