The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This package provides support for the foreach looping construct. Foreach is an idiom that allows for iterating over elements in a collection, without the use of an explicit loop counter. The main reason for using this package is that it supports parallel execution, that is, it can execute repeated operations on multiple processors/cores on your computer, or on multiple nodes of a cluster. Many different adapters exist to use foreach with a variety of computational backends, including:
A basic for
loop in R that fits a set of models:
<- split(iris, iris$Species)
dat_list <- vector("list", length(dat_list))
mod_list for(i in seq_along(dat_list)) {
<- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat_list[[i]])
mod_list[[i]] }
The same using foreach:
library(foreach)
<- foreach(dat=dat_list) %do% {
mod_list2 lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}
The same, but fit in parallel on a background cluster. We
change the %do%
operator to %dopar%
to
indicate parallel processing.
library(doParallel)
registerDoParallel(3)
<- foreach(dat=dat_list) %dopar% {
mod_list2 lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}
stopImplicitCluster()
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.