batchMap | R Documentation |
A parallel and asynchronous Map
/mapply
for batch systems.
Note that this function only defines the computational jobs.
The actual computation is started with submitJobs
.
Results and partial results can be collected with reduceResultsList
, reduceResults
or
loadResult
.
For a synchronous Map
-like execution, see btmapply
.
batchMap(
fun,
...,
args = list(),
more.args = list(),
reg = getDefaultRegistry()
)
fun |
[ |
... |
[ANY] |
args |
[ |
more.args |
[ |
reg |
[ |
[data.table
] with ids of added jobs stored in column “job.id”.
batchReduce
# example using "..." and more.args
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
f = function(x, y) x^2 + y
ids = batchMap(f, x = 1:10, more.args = list(y = 100), reg = tmp)
getJobPars(reg = tmp)
testJob(6, reg = tmp) # 100 + 6^2 = 136
# vector recycling
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
f = function(...) list(...)
ids = batchMap(f, x = 1:3, y = 1:6, reg = tmp)
getJobPars(reg = tmp)
# example for an expand.grid()-like operation on parameters
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
ids = batchMap(paste, args = data.table::CJ(x = letters[1:3], y = 1:3), reg = tmp)
getJobPars(reg = tmp)
testJob(6, reg = tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.