Introducing the snow Package

Luke Tierney’s snow (Simple Network of Workstations) package, available from the CRAN R code repository, is arguably the simplest, easiest-to-use form of parallel R and one of the most popular.

Note

The CRAN Task View page on parallel R, http://cran.r-project.org/web/views/HighPerformanceComputing.html, has a fairly up-to-date list of available parallel R packages.

To see how snow works, here’s code for the mutual outlinks problem described in the previous section:

1 # snow version of mutual links problem 2 3 mtl <- function(ichunk,m) { 4 n <- ncol(m) 5 matches <- 0 6 for (i in ichunk) { 7 if (i < n) { 8 rowi <- m[i,] 9 matches <- matches + 10 sum(m[(i+1):n,] %*% rowi) 11 } 12 } 13 matches 14 } 15 16 mutlinks <- function(cls,m) ...

Get The Art of R Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.