<p>Take a look at <a href="https://arxiv.org/abs/1709.01195" rel="nofollow noreferrer">Parallel Statistical Computing with R: An Illustration on Two Architectures</a>, which gives two ways to parallelize random forest calculations: with <code>mclapply</code> and with <code>pbdMPI</code>.</p>
Optimizing package randomForest speed using parallel processing
<p>How can I get the following code (alternative code would be great too) for enhancing the speed of randomForest analyses on a regression equation using multiple cores in a parallel approach to work? </p>

<pre><code>#Parallelized Random Forest Model
RFcores &lt;- detectCores()/3 + 4
RFcores
RFtrees &lt;- 1000/RFcores
RFtrees
cl &lt;- makeCluster(RFcores)
registerDoParallel(cl)
timer &lt;- proc.time()
form &lt;- as.formula(paste(a, "~", b))
fit &lt;- foreach(ntree = rep(RFtrees, RFcores), .combine = gtable_combine, .packages = 'randomForest') %dopar% 
   { 
                randomForest(form, data = maindf, mtry = 4, 
                             keep.forest = FALSE, nodesize = 10000, do.trace = TRUE, maxnodes = 5, 
                            improve = 0.01, doBest = TRUE, importance = TRUE, ntree = ntree)}
proc.time() - timer
stopCluster(cl)
}
</code></pre>

<p>I keep getting the following error related to the <code>.combine argument</code> in the <code>foreach</code> function.</p>

<pre><code>error calling combine function:
&lt;simpleError in align_2(x, y, along = along, join = join): Both gtables must have names along dimension to be aligned&gt;
</code></pre>

<p>I look forward to any thoughts on this issue.</p>