Let me add one more problem of determining the region R, this time with a snowfall package. If I define a function in my global environment, and I try to use it later in sfApply () inside another function, my first function is no longer found:
This gives:
> func2(y) Error in checkForRemoteErrors(val) : 2 nodes produced errors; first error: could not find function "func1"
If I use the function most of all inside another function, it works. It also works when I use sfApply () in a global environment. The fact is that I do not want to embed the func1 function inside this function2, since this can lead to the fact that func1 is defined many times (func2 is used in a loop-like structure).
I tried already simplifying the code to get rid of the double loop, but this is completely impossible due to the nature of the problem. Any ideas?
function r scoping
Joris Meys Oct 04 '10 at 2:36 p.m. 2010-10-04 14:36
source share