[R] parallel computation in plyr 1.7

Hadley Wickham hadley at rice.edu
Mon Jan 16 15:44:15 CET 2012


Please see https://github.com/hadley/plyr/issues/60
Hadley

On Thu, Jan 12, 2012 at 11:54 AM, abhagwat <bhagwataditya at gmail.com> wrote:
> The code below shows that
> (1) the way to activate the parallel backend indeed is to use 'registerDoMC'
> (2) the function d_ply does NOT accept the argument parallel, while the
> function ddply does. Perhaps it is interesting to add this feature to d_ply,
> l_ply and a_ply too? As a workaround one can off course use the function
> ddply with a dummy return value.
>
> # df & function
>        myDf = data.frame(a=factor(1:10), b=factor(1:10), c=1:10)
>
>        tryFun1 = function(myDf){
>                Sys.sleep(1)
>                return(mean(myDf$c))
>        }
> # ddply
>        ddply(.data=myDf, .variables=c('a', 'b'), .fun=tryFun, .progress='text')
>
>        registerDoMC()
>        getDoParWorkers()
>        ddply(.data=myDf, .variables=c('a', 'b'), .fun=tryFun, .progress='text',
> .parallel=TRUE)
> # d_ply
>        d_ply(.data=myDf, .variables=c('a', 'b'), .fun=tryFun, .progress='text')
>
>        registerDoMC()
>        d_ply(.data=myDf, .variables=c('a', 'b'), .fun=tryFun, .progress='text',
> .parallel=TRUE)
>
>
> Greetz,
>
> Adi
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/parallel-computation-in-plyr-1-7-tp4289556p4289833.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list