Re: [R] Parallel Programming

2012-09-21 Thread Bert Gunter
Inline below. On Fri, Sep 21, 2012 at 9:05 AM, R. Michael Weylandt wrote: > On Fri, Sep 21, 2012 at 5:43 AM, Tjun Kiat Teo wrote: >> I am trying to do parallel programming and I tried this >> >> library(doSNOW) >> library(foreach) >> >> testfunc<-function(x){ >> x<-x+1 >> x >> } >> >> noc<-2 >>

Re: [R] Parallel Programming

2012-09-21 Thread R. Michael Weylandt
On Fri, Sep 21, 2012 at 5:43 AM, Tjun Kiat Teo wrote: > I am trying to do parallel programming and I tried this > > library(doSNOW) > library(foreach) > > testfunc<-function(x){ > x<-x+1 > x > } > > noc<-2 > > cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") > registerDo

Re: [R] Parallel Programming

2012-09-20 Thread Jeff Newmiller
Then don't do that. Use your script file to define functions. Source that file before the loop to load them into memory. Call those functions from within your loop. --- Jeff NewmillerThe .