Description Usage Arguments Details Value See Also Examples
Adds data to a function so that it can be serialized and run on a remote
cluster, avoiding errors of type Object not found
.
1 | update_closure(fun, varlist, envir = .GlobalEnv)
|
fun |
function with old or no environment |
varlist |
character vector of names of objects to export. |
envir |
environment from which to export variables |
The updating behavior means that if fun
already has an
environment containing a = 10
then running a <- 20;
updateClosure(fun, "a")
will return a function where a = 20
.
This function is modeled after clusterExport
.
function with updated environment
1 2 3 | # To apply f you'll need to also get it's dependencies
f <- makeClosure(f, c("a", "helperfunc"))
clusterApply(sc, 1:10, f)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.