title: Using '. . .' for two purposes in a single R function
body: <p>In my function below, I want to use <code>...</code> for two purposes. The first <code>...</code> is to be used so <code>...</code> could be turned to a <code>list(...)</code>. The second <code>...</code> is simply there to represent the graphical parameters (e.g., <code>col</code>, <code>font</code>, etc.).</p>
  
  <p>I was wondering if there might be any way to use <code>...</code> OR any equivalent strategy so that my function works? </p>
  
  <pre><code>bb &lt;- function(..., ...){
  
  aa &lt;- function(x, add){ if(!add) { plot(density(x), ...) } else { lines(density(x), ...) } 
  } ## HERE `...` represents graphical parameters
  
  z &lt;- list(...) ## HERE `...` is used to form a list(...)
  loop &lt;- seq_len(length(z))
  
  for(i in loop){ aa(z[[i]], add = i != 1, ... = ...) }
  }
  
  #When fixed, the function should work in the following example:
  
  y1 &lt;- rnorm(200)
  y2 &lt;- rnorm(200)
  
  bb(y1, y2) # Should give two overlapping plots
  </code></pre>