title: Using global variable in function
body: <p>I have a very big dataset and I analyze it with R.</p>
  
  <p>The problem is that I want to add some columns with different treatments on my dataset AND I need some recursive function which use some global variable. Each function modify some global variable et create some variables. So the duplication of my dataset in memory is a big problem...</p>
  
  <p>I read some documentation: if I didn't misunderstand, neither the use of <code>&lt;&lt;-</code> nor <code>assign()</code> could help me...</p>
  
  <p>What I want:</p>
  
  <pre><code>mydata &lt;- list(read.table(), ...)
  myfunction &lt;- function(var1, var2) {
     #modification of global mydata
     mydata = ...
     #definition of another variable with the new mydata
     var3 &lt;- ...
     #recursive function
     mydata = myfunction(var2, var3)
  }
  </code></pre>
  
  <p>Do you have some suggestions for my problem?</p>