plapply {epoc}R Documentation

Parallell list apply

Description

Parallell list apply

Usage

plapply(X1, X2, FUN, ...)

Arguments

X1

a vector (atomic or list). Other objects (including classed objects) will be coerced by as.list.

X2

See X1.

FUN

the function to be applied to each pair of X1 and X2 at the corresponding positions.

...

optional arguments to FUN.

Details

FUN is found by a call to match.fun and typically is specified as a function or a symbol (e.g. a backquoted name) or a character string specifyign a function to be searched for from the environment of the call to plapply.

Function FUN must be able to accept as input any of the element pairs of X1 and X2. If any of these are atomic vectors, FUN will always be passed a length-one vector of the same type as X1, X2 respectively.

Users of S4 classes should pass a list to plapply: the internal coercion is done by the system as.list in the base namespace and not one defined by a user (e.g. by setting S4 methods on the system function).

Value

A list.

See Also

lapply

Examples

X1 <- array(1:4,dim=c(2,2))
X2 <- array(5:8,dim=c(2,2))
X3 <- array(9:12,dim=c(2,2))
X4 <- array(13:16,dim=c(2,2))
l <- plapply(list(X1,X2),list(X3,X4), function(E1,E2) E2 - E1)
stopifnot(all(sapply(l,sum)/4 == 4*2))

[Package epoc version 0.2.6-1.1 Index]