title: how to remove a variable from inside a function in R
body: <p>i am trying to create a function in which i want to remove one of the variables passed to it.</p>
  
  <p>now R works in annoying ways in that it copies the object instead of giving a reference.
  (technically the copying only happens if you make a change... but meh...)</p>
  
  <pre><code>a=function(b){
    rm(b)
    # rm(b)
  }
  test=123
  a(test) # will remove b, not test
  # you can verify that by adding the 2nd rm(b)
  </code></pre>
  
  <p>i tried</p>
  
  <pre><code>a=function(b){
    rm(match.call()[[2]])
  }
  </code></pre>
  
  <p>but that gives the error:</p>
  
  <pre><code> Error in rm(match.call()[[3]]) : 
    ... must contain names or character strings 
  </code></pre>