rparallel-processingexportsnowfall

How to export a predefined function using snowfall?


I was trying to run some simulations in 4 cores using snowfall package. I have used 'mgcv' library and its 'rmvn' function to simulate some multivariate data within a user defined function. I called snowfall package in another user defined function, and used 'sfExpotAll' to export all the variables in global environment. But it gave an error saying "could not find function "rmvn"".

Then I used sfExport('rmvn') to export it seperately, but then it gives an error saying, "Unknown/unfound variable rmvn in export".

I wonder where I have made the mistake. Any hint will be appreciated.


Solution

  • If you want to load a library use:

    sfLibrary("mgcv")
    

    If you want to source a file use:

    sfSource(pathtofile)