Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

batchMapResults

Maps a function over the results of a registry by using batchMap.


Description

Maps a function over the results of a registry by using batchMap.

Usage

batchMapResults(reg, reg2, fun, ..., ids, part = NA_character_,
  more.args = list())

Arguments

reg

[Registry]
Registry whose results should be mapped by fun.

reg2

[Registry]
Empty registry that should store the job for the mapping.

fun

[function(job, res, ...)]
Function to map over results of reg. Further arguments come from ... of batchMapResults and more.args.

...

[any]
Furher arguments to vectorize over (list or vector). Must all be the same length as number of results in reg.

ids

[integer]
Ids of jobs whose results should be mapped with fun. Default is all jobs.

part

[character] Only useful for multiple result files, then defines which result file part(s) should be loaded. NA means all parts are loaded, which is the default.

more.args

[list]
A list of other arguments passed to fun. Default is empty list.

Value

Vector of type integer with job ids.

Examples

reg1 = makeRegistry(id = "BatchJobsExample1", file.dir = tempfile(), seed = 123)
# square some numbers
f = function(x) x^2
batchMap(reg1, f, 1:10)

# submit jobs and wait for the jobs to finish
submitJobs(reg1)
waitForJobs(reg1)

# look at results
reduceResults(reg1, fun = function(aggr,job,res) c(aggr, res))

reg2 = makeRegistry(id = "BatchJobsExample2", file.dir = tempfile(), seed = 123)

# define function to tranform results, we simply do the inverse of the squaring
g = function(job, res) sqrt(res)
batchMapResults(reg1, reg2, fun = g)

# submit jobs and wait for the jobs to finish
submitJobs(reg2)
waitForJobs(reg2)

# check results
reduceResults(reg2, fun = function(aggr,job,res) c(aggr, res))

BatchJobs

Batch Computing with R

v1.8
BSD_2_clause + file LICENSE
Authors
Bernd Bischl <bernd_bischl@gmx.net>, Michel Lang <michellang@gmail.com>, Henrik Bengtsson <henrikb@braju.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.