title: R: using a list for ellipsis arguments
body: <p>I have run into a situation where I need to take all the extra arguments passed to an R function and roll them into an object for later use. I thought the <a href="https://stackoverflow.com/questions/3057341/how-to-use-rs-ellipsis-feature-when-writing-your-own-function">previous question about ellipses</a> in functions would help me, but I still can't quite grasp how to do this. Here is a very simple example of what I would like to do:</p>
  
  <pre><code>newmean &lt;- function(X, ...){
    args &lt;- as.list(substitute(list(...)))[-1L]
    return(mean(X, args))
  }
  </code></pre>
  
  <p>I've tried a number of different formulations of args in the above example and tried unlisting args in the return call. But I can't make this work. Any tips?</p>
  
  <p>I realize that I could do this:</p>
  
  <pre><code>newmean &lt;- function(X, ...){
      return(mean(X, ...))
  }
  </code></pre>
  
  <p>But I need to have the ... arguments in an object which I can serialize and read back into another machine. </p>