Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

foreach-package

The Foreach Package


Description

The foreach package provides a new looping construct for executing R code repeatedly. The main reason for using the foreach package is that it supports parallel execution. The foreach package can be used with a variety of different parallel computing systems, include NetWorkSpaces and snow. In addition, foreach can be used with iterators, which allows the data to specified in a very flexible way.

Details

Further information is available in the following help topics:

foreach Specify the variables to iterate over
%do% Execute the R expression sequentially
%dopar% Execute the R expression using the currently registered backend

To see a tutorial introduction to the foreach package, use vignette("foreach").

To see a demo of foreach computing the sinc function, use demo(sincSEQ).

Some examples (in addition to those in the help pages) are included in the "examples" directory of the foreach package. To list the files in the examples directory, use list.files(system.file("examples", package="foreach")). To run the bootstrap example, use source(system.file("examples", "bootseq.R", package="foreach")).

For a complete list of functions with individual help pages, use library(help="foreach").

Author(s)

Maintainer: Hong Ooi hongooi@microsoft.com

Authors:

  • Microsoft [copyright holder]

  • Steve Weston

See Also

Useful links:


foreach

Provides Foreach Looping Construct

v1.5.1
Apache License (== 2.0)
Authors
Michelle Wallig [cre], Microsoft [aut, cph], Steve Weston [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.