title: Access all function arguments in R
body: <p>I've a function f() that has some named parameters. It calls a function g() and I want to pass all f's parameters to it. Is this possible?</p>
  
  <p>Using ... just covers the extra arguments:</p>
  
  <pre><code>f=function(a,callback,b,c,d,...){
    z=a-b
    callback(z,...) 
    }
  
  g=function(z,...){
    print(list(...))    #Only shows $e
    print(z)    #-1
    print(a,b,c,d)  #'a' not found   
  }
  
  f(1,g,2,3,d=4,e=5);
  </code></pre>
  
  <p>I thought formals() was the answer, but it just seems to be argument names, not their values!</p>
  
  <pre><code>f=function(a,callback,b,c,d,...){
    z=a-b
    callback(z,formals()) 
    }
  
  g=function(z,...){
    args=list(...)[[1]]
    print(args$a) #(no output)
    print(class(args$a))  #"name"
  }
  
  f(1,g,2,3,d=4,e=5);
  </code></pre>
  
  <p>Is it possible? Thanks.</p>