I am trying to run my R code in parallel. Following is the toy example in which myfunc function returns a number.
library(snowfall);
sfInit(parallel=TRUE,cpus=5)
a <- 1 : 10000
sfExport("a")
parwrapper <- function(i){
mysimulation <- myfunc(b=30,c=a[i])
return(mysimulation)}
sfapply(1:10000,parwrapper)
This is the error that I get. Error in checkForRemoteErrors(val) : 5 nodes produced errors; first error: could not find function "myfunc"