fe69dd920d
change from multicore to parallel requirement as multicore is deprecated
12 lines
368 B
R
12 lines
368 B
R
require("parallel")
|
|
|
|
mcsapply <- function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)
|
|
{
|
|
FUN <- match.fun(FUN)
|
|
answer <- mclapply(X = X, FUN = FUN, ...)
|
|
if (USE.NAMES && is.character(X) && is.null(names(answer)))
|
|
names(answer) <- X
|
|
if (!identical(simplify, FALSE) && length(answer))
|
|
simplify2array(answer, higher = (simplify == "array"))
|
|
else answer
|
|
}
|