I'd like to have the option of using foreach but be able to restrict
processing to be parallel in one of my packages.

I'd rather not have

   x <- if(goParallel) foreach(stuff) %dopar% foo else foreach(stuff) %do%
foo

Also, the function is nested within layers that conduct parallel processing
(i.e. the foo above might also use dopar inside) and my impression is
that registerDoSEQ would shut down parallel processing for both functions.

It looks like %do% and %dopar% are not existing objects:

   > str(%do%)
   Error: unexpected SPECIAL in "str(%do%"

Otherwise I would add some conditional logic to switch between them such as

   operator <- if(goParallel) %dopar% else %do%
    x <- foreach(stuff) operator foo

Thanks,

Max

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] foreach_1.4.0

loaded via a namespace (and not attached):
[1] codetools_0.2-8 iterators_1.0.6

	[[alternative HTML version deleted]]

