papply: Parallel version of lapply

View source: R/papply.R

papplyR Documentation

Parallel version of lapply

Description

Detects and opens cores for simpler parallel lapply.

Usage

papply(X, FUN, ..., cores = 1, outfile = "", msg = NULL, pb = TRUE)

Arguments

X, FUN, ...

See lapply.

cores

An integer giving the number of cores to run the function FUN over.

outfile

Set this to FALSE to suppress printing from the cores.

msg

A message to pring to the console, followed by the number of runs (and the number of cores in the case of parallel processing).

pb

Logical: If FALSE suppress the progress bar.

Examples

f <- function(i){
	for(j in 1:3){
		for(k in 1:500){
			Sys.sleep(0.001)
			d <- runif(100)
		}
	}	
}
system.time(p <- papply(1:4, f, cores=1))
system.time(p <- papply(1:4, f, cores=2))


arnejohannesholmin/TSD documentation built on April 14, 2024, 5:29 a.m.