I am just getting started with foreach
& parallel
and encountered some challenges with combining my outputs from each iteration.
Currently, in each iteration, I am outputting a set of variables that I would like to combine into a vector, so that I can obtain some summary stats for across all iterations. An example:
foreach (s = 1:num) %dopar%{
var1 = ...
var2 = ...
var3 = ...}
Ultimately I'd like 3 vectors containing each iteration's produced output, so: var1 = c(var1 from s=1, var1 from s=2, var1 from s=3, ...)
I looked into the .combine option and attempted to create a function that would append, but found no success.