[Rd] Can I use "..." in parallel:::clusterApplyLB?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Feb 13 09:54:24 CET 2012


On 13/02/2012 06:51, Slava Razbash wrote:
> Hello,
>
> Can I do the following? Is parallel:::clusterApplyLB() designed to
> work like this? The code below is for illustrative purposes only.

It is designed to work with standard R semantics.  For ... those are 
quite complex, and you may have to force evaluation before sending to 
the workers: that is easy to do, and there are examples in package boot.


> library(parallel)
>
> myFunction<-function(myPar1, myPar2, ...) {
>
>      clusterApplyLB(myCluster, x, otherFunction, otherPar1=myPar1,
> otherPar2=myPar2, ....)
>
>
> }
>
>
> otherFunction<-function(otherPar1, otherPar2, ...) {
>
>     someFunction(somePar1, ....)
>
> }

Well, that will not work.  See what the posting guide has to say about 
reproducible examples.

>
> someFunction<-function(somePar1, somePar2=NULL, somePar3=someVal) {
>
>     ##Do some stuff
>
>
> }
>
>
> myFunction( myVal1, myVal2, somePar2=myVal3, somePar3=myVal4)
>
>
>
> The intention is that myVal3 and myVal4 get passed to someFunction()
> through clusterApplyLB if they are specified.
>
>
> Best Regards,
>
> Slava
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list