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@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.

Reply via email to