You need to export the f1
function to the workers using the sfExport
function between sfInit
and sfLapply
:
sfExport('f1')
This is the snowfall
equivalent to the snow
clusterExport
function.
To export multiple variables, you can either use multiple arguments or the list
argument:
sfExport('f1', 'x')
sfExport(list=c('f1', 'x'))
To export all variables in your global environment, use sfExportAll
:
sfExportAll()