[R] could not find function in mempry inside foreach loop

2016-04-13 Thread cheng huimin
I'm trying to use foreach function to do multicore computing in R.



Error in FUN(train_adjmt, iter = missedmat[i, 1], iter2 = missedmat[i,  :
  task 1 failed - "找不到对象'predictMatrix'"

then I call function A in the console. The problem is I'm calling a
function Posdef inside B that is defined in another script file which I
source. I had to put predictMatrix in the list of export argument of foreach
: .export=c("predictMatrix"). However I get the following error:

Warning message:
In e$fun(obj, substitute(ex), parent.frame(), e$data) :
  already exporting variable(s): predictMatrix

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

[R] could not find function in mempry inside foreach loop

2016-04-13 Thread cheng huimin
I'm trying to use foreach function to do multicore computing in R.

A <-function() {
foreach(i=1:10) %dopar% {
B()
}}

then I call function A in the console. The problem is I'm calling a
function  ipredictMatrix inside B that is defined in another script file
which I source.However I get the following error:

Error in FUN(train_adjmt, iter = missedmat[i, 1], iter2 = missedmat[i,  :
  task 1 failed - "找不到对象'predictMatrix'"

Then  I tried to put predictMatrix in the list of export argument of foreach
: .export=c("predictMatrix"). However I get the following error:

Warning message:
In e$fun(obj, substitute(ex), parent.frame(), e$data) :
  already exporting variable(s): predictMatrix

Why  can't R find this defined function? How to solve this problem?
Futermore ,R-version I am using is "3.2.3",and my computer is running on
windows.

Thanks,
Alice

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.