sfFArgsApplyLB

Share:

Description

Load balanced application of F_APPLY to arguments supplied by function F_ARGS(i).

Usage

1
2
sfFArgsApplyLB(N_APPLYCASES, F_ARGS, F_APPLY, ..., SFFARGSAPPLY_ADDARGS = list(), 
    debugSequential = FALSE)

Arguments

N_APPLYCASES

i=1..N_APPLYCASES

F_ARGS

function(i) returning a list of first arguments to F_APPLY

F_APPLY

function to be applied

...

further arguments passed to F_APPLY

SFFARGSAPPLY_ADDARGS

further arguments passed to F_APPLY

debugSequential

evaluate using lapply instead of dynamicClusterApply

Value

a list of results of F_APPLY

Author(s)

Thomas Wutzler

See Also

twSnowfall

Examples

1
2
3
4
5
6
7
8
9
#sfInit(parallel=TRUE,cpus=2)

X <- matrix(0:9,nrow=5,ncol=2)
dimnames(X) <- list( rows=paste("r",1:nrow(X),sep=""), cols=paste("c",1:ncol(X),sep="")  )
Y <- X*10
# delivering row i of X and row i of Y as arguments to F_Apply
F_ARGS <- function(i){list(arg1=X[i,],arg2=Y[i,])}
F_APPLY <- paste
.res <- sfFArgsApplyLB( nrow(X), F_ARGS, F_APPLY, sep="-")