[R-sig-hpc] snow: export data inside function and check worspaces

Steve Weston steve at revolution-computing.com
Mon Apr 27 17:41:20 CEST 2009


On Mon, Apr 27, 2009 at 2:53 AM, Matthieu Stigler
<matthieu.stigler at gmail.com> wrote:
> Hi
>
> I have two questions for package snow:
>
> 1 How do I export object defined within a function with clusterExport()?
> snow use get("object", env=.GlobalEnv) but the object within a function
> belong to the function env and not globalenv if I understood well.

If you want to use clusterExport, I believe you would have to
first assign the value of the local variable to a global variable,
since that is the only thing that clusterExport will operate on.
You might want to consider other methods of handling that
data, though.

> 2 How do I check the objects sent? I tried clusterCall(cl, ls()) but gives
> me character(0)

Try something like:

   clusterCall(cl, function() ls(globalenv()))

-- 
Steve Weston
REvolution Computing
One Century Tower | 265 Church Street, Suite 1006
New Haven, CT  06510
P: 203-777-7442 x266 | www.revolution-computing.com



More information about the R-sig-hpc mailing list