Reduce results from result directory.
The following functions provide ways to reduce result files into either specific R objects (like vectors, lists, matrices or data.frames) or to arbitrarily aggregate them, which is a more general operation.
reduceResults(reg, ids, part = NA_character_, fun, init, impute.val, progressbar = TRUE, ...) reduceResultsList(reg, ids, part = NA_character_, fun, ..., use.names = "ids", impute.val, progressbar = TRUE) reduceResultsVector(reg, ids, part = NA_character_, fun, ..., use.names = "ids", impute.val) reduceResultsMatrix(reg, ids, part = NA_character_, fun, ..., rows = TRUE, use.names = "ids", impute.val) reduceResultsDataFrame(reg, ids, part = NA_character_, fun, ..., use.names = "ids", impute.val, strings.as.factors = default.stringsAsFactors()) reduceResultsDataTable(reg, ids, part = NA_character_, fun, ..., use.names = "ids", impute.val)
reg |
[ |
ids |
[ |
part |
[ |
fun |
[ |
init |
[ |
impute.val |
[any] |
progressbar |
[ |
... |
[any] |
use.names |
[ |
rows |
[ |
strings.as.factors |
[ |
Aggregated results, return type depends on function. If ids
is empty: reduceResults
returns init
(if available) or NULL
, reduceResultsVector
returns c()
,
reduceResultsList
returns list()
, reduceResultsMatrix
returns matrix(0,0,0)
,
reduceResultsDataFrame
returns data.frame()
.
# generate results: reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123) f = function(x) x^2 batchMap(reg, f, 1:5) submitJobs(reg) waitForJobs(reg) # reduce results to a vector reduceResultsVector(reg) # reduce results to sum reduceResults(reg, fun = function(aggr, job, res) aggr+res) reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123) f = function(x) list(a = x, b = as.character(2*x), c = x^2) batchMap(reg, f, 1:5) submitJobs(reg) waitForJobs(reg) # reduce results to a vector reduceResultsVector(reg, fun = function(job, res) res$a) reduceResultsVector(reg, fun = function(job, res) res$b) # reduce results to a list reduceResultsList(reg) # reduce results to a matrix reduceResultsMatrix(reg, fun = function(job, res) res[c(1,3)]) reduceResultsMatrix(reg, fun = function(job, res) c(foo = res$a, bar = res$c), rows = TRUE) reduceResultsMatrix(reg, fun = function(job, res) c(foo = res$a, bar = res$c), rows = FALSE) # reduce results to a data.frame print(str(reduceResultsDataFrame(reg))) # reduce results to a sum reduceResults(reg, fun = function(aggr, job, res) aggr+res$a, init = 0)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.