Dear all, I would like to ask your help of how I can convert the loop below to a mclapply (this is the apply to many cores)
for (i in seq(from=-1,to=1-2/ncol(sr),length=ncol(sr))){ for (j in seq(from=-1,to=1-2/nrow(sr),length=nrow(sr))){ estimatedsr[findC(c(i,j),sr)[1],findC(c(i,j),sr)[2] ]<-fxy(c(i,j)) } } lst[[i,j]] <-estimatedsr What the loop above does is that calculates a value and then saves it inside the lst matrix. I am not sure how I should convert this process to run with many cores. What confuses me that my in this code one should track the i,j values so each cores saves at the right place inside the lst matrix. Could you please help me with that? Regards Alex --- On Thu, 2/17/11, Ben Haller <rh...@sticksoftware.com> wrote: > From: Ben Haller <rh...@sticksoftware.com> > Subject: Re: [R] multi process support in R > To: "Alaios" <ala...@yahoo.com> > Cc: R-help@r-project.org > Date: Thursday, February 17, 2011, 10:47 AM > On Feb 17, 2011, at 11:40 AM, Alaios > wrote: > > > ...Is it possible to split work in many cores in R and > if yes how is this library called? > > I'd recommend the "mclapply" function in the > "multicore" package. The only drawback is that you > can't run your code in a GUI any more. > > Ben Haller > McGill University > > > ______________________________________________ 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.