0

This post describes how to pass packages to all clusters: Function not found in R doParallel 'foreach' - Error in { : task 1 failed - "could not find function "raster""

However, I would like to pass functions to the clusters (because I use them in the foreach-loop), that are not part of an R-package. How can I do this?

Edit: My only idea was to run another foreach-loop from 1:#cluster before the actual foreach-loop and define the function in each cluster. But this is a) not very elegant and b) it doesn't work (function can still not be found)

Cœur
  • 37,241
  • 25
  • 195
  • 267
jmb
  • 625
  • 7
  • 11
  • Please include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that shows the code you are trying to run. It would be best if your example was minimal yet sufficient to reproduce the error you get. – MrFlick Nov 26 '14 at 16:30
  • 2
    Have you tried using `.export`? – Roland Nov 26 '14 at 16:53
  • @Roland, yep that's it. I found it after a while despite its rather strange description in the manual. – jmb Nov 26 '14 at 21:10

0 Answers0