Updates to the foreach package and its friends

October 21, 2015

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)