# Source registry: calculate squre of some numbers
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
batchMap(function(x) list(square = x^2), x = 1:10, reg = tmp)
submitJobs(reg = tmp)
waitForJobs(reg = tmp)
# Target registry: map some results of first registry to calculate the square root
target = makeRegistry(file.dir = NA, make.default = FALSE)
batchMapResults(fun = function(x, y) list(sqrt = sqrt(x$square)), ids = 4:8,
target = target, source = tmp)
submitJobs(reg = target)
waitForJobs(reg = target)
# Map old to new ids. First, get a table with results and parameters
results = rjoin(getJobPars(reg = target), reduceResultsDataTable(reg = target))
# Parameter '..id' points to job.id in 'source'. Use an inner join to combine:
ijoin(results, reduceResultsDataTable(reg = tmp), by = c("..id" = "job.id"))
Run the code above in your browser using DataLab