Displaying 1 result from an estimated 1 matches for "withglobals".
2013 Dec 24
2
Parallel computing: how to transmit multiple parameters to a function in parLapply?
Hi R-developers
In the package Parallel, the function parLapply(cl, x, f) seems to allow
transmission of only one parameter (x) to the function f. Hence in order to
compute f(x, y) parallelly, I had to define f(x, y) as f(x) and tried to
access y within the function, whereas y was defined outside of f(x).
Script:
library(parallel)
f <- function(x) {
z <- 2 * x + .GlobalEnv$y # Try to