title: Parallellize Independent Function Calls that Each Modify Function's Parent Environment
body: <p>I'd like to find a way to parallelize repeated independent function calls in which each call modifies the function's parent environment. Each execution of the function is independent, however, for various reasons I am unable to consider any other implementation that doesn't rely on modifying the function's parent environment. See simplified example below. Is there a way to pass a copy of the parent environment to each node? I am running this on a linux system.</p>
  
  <pre><code> create_fun &lt;- function(){
  
          helper &lt;- function(x, params) {x+params}
          helper2 &lt;- function(z) {z+helper(z)}
  
          master &lt;- function(y, a){
              parent &lt;- parent.env(environment())
              formals(parent[['helper']])$params &lt;- a
              helper2(y)}
  
         return(master)
  }
  
  # function to be called repeatedly
  master &lt;- create_fun()
  
  # data to be iterated over
  x &lt;- expand.grid(1:100, 1:5)
  
  # vector where output should be stored
  results &lt;- vector("numeric", nrow(x))
  
  # task I'd like to parallelize
  for(i in 1:nrow(x)){
      results[i] &lt;- master(x[i,1], x[i, 2])
  }
  </code></pre>