I'm trying to use foreach to do multicore computing in R.
A <-function(....) {
foreach(i=1:10) %dopar% {
B()
}
}
then I call function A
in the console. The problem is I'm calling a function Posdef
inside B
that is defined in another script file which I source. I had to put Posdef
in the list of export argument of foreach
: .export=c("Posdef")
. However I get the following error:
Error in { : task 3 failed - "could not find function "Posdef""
Why cant R find this defined function?
clusterExport(cl, 'myMean')
suggested here #17880266 – Birthplace