Scoping problem when sfApply is used within function (package snowfall - R)
问题 Let me add another scoping problem in R, this time with the snowfall package. If I define a function in my global environment, and I try to use that one later in an sfApply() inside another function, my first function isn't found any more : #Runnable code. Don't forget to stop the cluster with sfStop() require(snowfall) sfInit(parallel=TRUE,cpus=3) func1 <- function(x){ y <- x+1 y } func2 <- function(x){ y <- sfApply(x,2,function(i) func1(i) ) y } y <- matrix(1:10,ncol=2) func2(y) sfStop()