title: R: using ellipsis argument (...)
body: <p>I want to create a wrapper function replacing some of the default arguments.</p>
  
  <p>Here the core of the problem I'm struggling with:</p>
  
  <pre><code>Error in localWindow(xlim, ylim, log, asp, ...) : 
    formal argument "cex" matched by multiple actual arguments
  </code></pre>
  
  <p>Now a bit of a context. Suppose I define a wrapper function for plot like this:</p>
  
  <pre><code>myplot &lt;- function(x, ... ) {
      plot(x, cex= 1.5, ... )
  }
  </code></pre>
  
  <p>If I call <code>myplot( 1:10, cex= 2 )</code> I will get the above error. I know I can turn <code>...</code> to a list</p>
  
  <pre><code>l &lt;- list(...)
  </code></pre>
  
  <p>and then I could do</p>
  
  <pre><code>if( is.null( l[["cex"]] ) ) l[["cex"]] &lt;- 2
  </code></pre>
  
  <p>However, how can I "insert" this list back to the ellipsis argument? Something like (I know this won't work):</p>
  
  <pre><code>... &lt;- l
  </code></pre>
  
  <p>EDIT: I could use defaults in <code>myplot</code> definition (as suggested in the answer from @Thomas), but I don't want to: the function interface will become cluttered. I guess I could define a helper function like that:</p>
  
  <pre><code> .myfunchelper &lt;- function( x, cex= 2.0, ... ) {
     plot( x, cex= cex, ... )
   }
  
   myfunc &lt;- function( x, ... ) {
      .myfunchelper( x, ... )
   }
  </code></pre>
  
  <p>But (i) it is less elegant and (ii) doesn't satisfy my curiosity.</p>