title: using substitute to get argument name with
body: <p>I'm trying to get the names of arguments in the global environment within a function.  I know I can use substitute to get the name of named arguments, but I would like to be able to do the same thing with ... arguments.  I kinda got it to work for the first element of ... but can't figure out how to do it for the rest of the elements.  Any idea how to get this working as intended.</p>
  
  <pre><code>foo &lt;- function(a,...)
  {
      print(substitute(a))
      print(eval(enquote(substitute(...))))
      print(sapply(list(...),function(x) eval(enquote(substitute(x)),env=.GlobalEnv)))
  }
  
  x &lt;- 1
  y &lt;- 2
  z &lt;- 3
  foo(x,y,z)
  
  x
  y
  [[1]]
  X[[1L]]
  
  [[2]]
  X[[2L]]
  </code></pre>