Hi guys,

I was wondering why this piece of code doesn't work:

foreach (i = c(1.25,1.50)) %dopar% {
assign(paste("test_",i,sep=""),i)
}

but, this does:

foreach (i = c(1.25,1.50)) %do% {
assign(paste("test_",i,sep=""),i)
}

Obviously, the difference is %dopar% vs. %do%. If I use %do%, I get
objects test_1.25 and test_1.50, but I don't get these objects if I
use %dopar% even though it seemed to run through the loop in parallel.

Thanks in advance,
Vivek

______________________________________________
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.

Reply via email to