title: R foreach %dopar% : export results to main R process
body: <p>%dopar% forks the main R process into several independent sub-processes. Is there a way to make these sub-processes communicate with the main R process, so that data can be 'recovered' ?</p>
  
  <pre><code>require(foreach) 
  require(doMC) 
  registerDoMC() 
  options(cores = 2 )
  
  a &lt;- c(0,0)
  foreach(i = 1:2 ) %do% {
      a[i] &lt;- i
  }
  print(a) # returns 1 2
  
  a &lt;- c(0,0)
  foreach(i = 1:2 ) %dopar% {
      a[i] &lt;- i
  }
  print(a) # returns 0 0
  </code></pre>
  
  <p>Thanks!</p>