parallel R execution problem in R parallel R execution problem in R r r

parallel R execution problem in R


I've not used doSMP, but I did some digging around and it looks like this post gets at a similar issue.

so it looks like you should be able to do:

foreach( i=1:2, .packages="data.table")  %dopar% {    DF[J("a"),]}

I can't test as I don't have a Windows machine handy.


OK, I asked Revolution computing, and Steve Weller (of RC) replied:

The problem is a R scoping issue. By default, foreach() will look for variables defined in it's own 'environment'. Any objects defined outside of it's scope need to be explicitly passed to it via the '.export' argument.

In your case, you will need to modify your 'foreach()' call to pass in the objects 'DF' and 'J':

...foreach(i=1:2, .export=c("DF","J")) %dopar% {...

I haven't tried either solution yet, but I trust both JD and RC...