[R-sig-hpc] foreach "could not find function ..." error

James Maas (MED) J.Maas at uea.ac.uk
Sat Jun 23 18:03:43 CEST 2012


Non expert here!

I'm helping a friend re-write some code that involves nested functions, so it will run in parallel, and to do it using current methods it involves 
nesting a foreach loop in a function that is later called.  I'm using MPI, but have also tried it with SNOW and get the same
error, which returns the following error

Error in { : task 1 failed - "could not find function "func2""

I googled and dug around and found where someone had suggested a "helper function" but that doesn't seem to 
be a solution either.  I'm guessing this has something to do with scoping? 

Is there a way to export a function so it becomes universal and available to all other functions including within a foreach loop?

I've attached a toy model that demonstrates our structure.  There might be much more elegant ways to do it, or there might even be
fundamental errors here.  Any suggestions how to overcome this problem?

Thanks

J
===============================
Dr. Jim Maas
University of East Anglia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: examp_ls.R
Type: application/x-extension-r
Size: 705 bytes
Desc: examp_ls.R
URL: <https://stat.ethz.ch/pipermail/r-sig-hpc/attachments/20120623/cbf3f275/attachment.bin>


More information about the R-sig-hpc mailing list