[R] foreach not recognizing functions in memory

saskay sashi1985 at gmail.com
Wed Jul 13 20:59:15 CEST 2011


Try the below code:
==============================

library(foreach)
library(doSNOW)
getDoParWorkers()
getDoParName()
registerDoSNOW(makeCluster(2, type = "SOCK"))
getDoParWorkers()
getDoParName()

testFun <- function(m) {
    out <- m*m
}

out <- foreach(m=1:10, .combine=rbind,*.verbose=T*) %dopar% testFun(m)

helper <- function(i) {

   out <- foreach(m=1:i, .combine=rbind,*.export="testFun", .verbose=T*)
%dopar% testFun(m)
 }

 out <- helper(10)

--
View this message in context: http://r.789695.n4.nabble.com/foreach-not-recognizing-functions-in-memory-tp3663603p3665806.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list