Skip to content

Simple parallel for loop

6 messages · Alaios, R. Michael Weylandt

#
Take a look at foreach() and %dopar$ from the CRAN package foreach.

Michael
On Tue, May 15, 2012 at 1:57 AM, Alaios <alaios at yahoo.com> wrote:
#
I haven't actually used foreach very much myself, but I would imagine
that you could just take advantage of the fact that most plot
functions return their arguments silently and then just throw the
results away (i.e., don't assign them)

Switching %do% to %dopar% automatically activates parallelization
(dopar being "do in parallel")

I believe you decide the number of cores to use when you set up your
parallel backend (either multicore or snow)

Hope this helps,
Michael
On Tue, May 15, 2012 at 2:20 AM, Alaios <alaios at yahoo.com> wrote:
#
Perhaps mcmapply from the parallel package? It's a parallel mapply to
complement mclapply.

Michael
On Tue, May 15, 2012 at 2:28 AM, Alaios <alaios at yahoo.com> wrote: