Learn R Programming

batchtools (version 0.9.0)

reduceResultsList: Apply Functions on Results

Description

Applies a function on the results of your finished jobs and thereby collects them in a list or data.table. The later requires the provided function to return a list (or data.frame) of scalar values. See rbindlist for features and limitations of the aggregation.

Usage

reduceResultsList(ids = NULL, fun = NULL, ..., reg = getDefaultRegistry())

reduceResultsDataTable(ids = NULL, fun = NULL, ..., fill = FALSE, reg = getDefaultRegistry())

Arguments

ids
[data.frame or integer] A data.frame (or data.table) with a column named “job.id”. Alternatively, you may also pass a vector of integerish job ids. If not set, defaults to the return value of findDone.
fun
[function] Function to apply to each result. The result is passed unnamed as first argument. If NULL, the identity is used. If the function has the formal argument “job”, the Job/Experiment is also passed to the function.
...
[ANY] Additional arguments passed to to function fun.
reg
[Registry] Registry. If not explicitly passed, uses the default registry (see setDefaultRegistry).
fill
[logical(1)] In reduceResultsDataTable: This flag is passed down to rbindlist which is used to convert the results to a data.table.

Value

reduceResultsList returns a list of the results in the same order as the provided ids. reduceResultsDataTable returns a data.table with columns “job.id” and additional result columns created via rbindlist, sorted by “job.id”.

See Also

reduceResults.

Other Results: batchMapResults, loadResult, reduceResults

Examples

Run this code
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
batchMap(function(x) x^2, x = 1:10, reg = tmp)
submitJobs(reg = tmp)
waitForJobs(reg = tmp)
reduceResultsList(fun = sqrt, reg = tmp)

Run the code above in your browser using DataLab