[R] Apparent namespace problem
Thomas W Blackwell
tblackw at umich.edu
Mon Apr 28 16:42:56 CEST 2003
Ross -
Inside whatever function defines the variable gcv,
do: assign("gcv", gcv, 1) after you've defined gcv
and before the function exits. help("assign") gives
other ways to specify the target namespace (not all
of which I quite understand).
My hunch is this has nothing to do with snow or the
cluster architecture. (I could be totally wrong.)
- tom blackwell - u michigan medical school - ann arbor -
On Fri, 25 Apr 2003, Ross Boylan wrote:
> I'm seeing some strange behavior while using the snow package
> for networked computers. I believe it's caused by name space
> resolution issues, and would appreciate any suggestions tracking
> it down.
>
> First, is there a way to find out what frame (as in frames in
> environments, not data frames) a name is being obtained from
> or put into?
>
> Second, how closely does the evaluation environment in the
> browser/debugger match what you would get in the function at
> the same point? I ask because if I evaluate a statement in
> the browser it seems to work one way, but if I execute it
> it works another way.
>
> The statement is
> clusterEvalQ(cl, crossval.setup(x, y, groups, theta.fit,
> theta.predict))
>
> This evaluates the crossval.setup function across the cluster cl.
>
> crossval.setup is a function which puts its arguments in a list g
> (a local variable) and then does gcv <<- g. The intent is to stuff
> the data into a global variable for use by later function calls.
>
> When I execute the statement interactively, even in the debugger
> in the function that executes the statement, it seems to work.
> But if it executes in the function, gcv appears to remain unset.
>
> I assume gcv is getting set in some other frame, but where it is
> and how to track it down I don't know.
>
> In an effort to get around this I did gcv <- list() in the global
> namespace (on the distributed nodes), but this doesn't seem to help.
> I'm just left with the empty list, even after calls to crossval.setup.
>
> Any ideas?
More information about the R-help
mailing list