Skip to content
Prev 258115 / 398502 Next

Assignments inside lapply

I would like to use lapply as there is a parallel version of lapply called mclapply.

My purpose is to convert 
for (i in c(1:dimx)){
   for (j in c(1:dimy)){
       Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
 }}

to something that can run in parallel with mclapply:
I am not sure then how to store the results of lapply(mclapply) correctly to Powermap matrix. That is the reason I put the assignment inside the return statement.
For example this does not do what I want to
Powermap[i,j]<-unlist(mclapply(1:nrow(ij),function(rowId) { return (Pr(c(ij$i[rowId],ij$j[rowId]),c(PRX,PRY),f)
How can I try this out?

Best Regards
Alex
--- On Wed, 4/27/11, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote: