Updates to the foreach package and its friends

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

By Andrie de Vries

Earlier this month Rich Calaway, programme manager at Microsoft and maintainer of the foreach package, published some updates to the foreach suite of packages, including:

Most of the changes were cosmetic, or to conform to CRAN policy. However, the last two packages (doParallel and doSNOW) had some functional changes.


The doSNOW package is a foreach parallel adaptor for the ‘snow’ Package. Thus it provides a parallel backend for the %dopar% function using Luke Tierney’s snow package. (The snow package itself enables a “Simple Network of Workstations”, i.e. support for simple parallel computing in R.)

The functional changes to doSNOW were the addition of support for user-defined progress bars.

This means that you easily enable progress bars when setting up a parallel job with doSNOW.

Easy progress bar with foreach and doSNOW

You can try it out with this code:

You can get other examples here.


The doParallel package provides a parallel backend for the %dopar% function using the parallel package (part of base R).

In doParallel, the most important change (change log) was a bug fix to stopImplicitCluster functionality, courtesy of Dan Tenenbaum.


Previous blog posts

We have previously written about the foreach package and parallel processing:


To get started with foreach, take a look at the vignette at https://cran.r-project.org/web/packages/foreach/vignettes/foreach.pdf

To get started with parallel programming with foreach and doParallel, the vignette is a great a resource: https://cran.r-project.org/web/packages/doParallel/vignettes/gettingstartedParallel.pdf



To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)