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

batchExpandGrid

Map function over all combinations.


Description

Maps an n-ary-function over a list of all combinations which are given by some vectors. Internally expand.grid is used to compute the combinations, then batchMap is called.

Usage

batchExpandGrid(reg, fun, ..., more.args = list())

Arguments

reg

[Registry]
Empty Registry that will store jobs for the mapping.

fun

[function]
Function to map over the combinations.

...

[any]
Vectors that are used to compute all combinations. If the arguments are named, these names are used to bind to arguments of fun.

more.args

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

Value

[data.frame]. Expanded grid of combinations produced by expand.grid.

Examples

reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123)
f = function(x, y, z) x * y  + z
# lets store the param grid
grid = batchExpandGrid(reg, f, x = 1:2, y = 1:3, more.args = list(z = 10))
submitJobs(reg)
waitForJobs(reg)
y = reduceResultsVector(reg)
# later, we can always access the param grid like this
grid = getJobParamDf(reg)
cbind(grid, y = y)

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.