I have the following (sample) code which is executed in passive mode on computing clusters:
> foo <- function(...)
> {
> require(copula)
> require(foreach)
> require(methods)
> require(np)
> require(parallel)
> {cl <- makeCluster(detectCores()-1) ; registerDoParallel(cl)}
...
> str(dat)
'data.frame': 31269 obs. of 15 variables
...
> clusterExport(cl=cl,varlist=c("dat",...))
> dumpster <- foreach(i=1:10,.packages=c("copula","foreach","np"),.export=c("dat"))%dopar%
> {... ; dat.new <- some.fn(dat) ; ...}
...
> stopCluster(cl)
> }
> foo(...)
Error in get(name, envir = envir) : object 'dat' not found
Calls: foo ... postNode -> sendData -> sendData.SOCKnode -> serialize -> get
Execution halted
What am I doing wrong?