title: How to pass "..." arguments to a function called from foreach()?
body: <p>The following code produces the warning:</p>
  
  <pre><code>Warning message:
  &lt;anonymous&gt; : &lt;anonymous&gt;: ... may be used in an incorrect context: ‘mean(x[l], ...)’
  
  doForeach &lt;- function(x, ...)
  {
      require(doSNOW)
      require(foreach)
      cl &lt;- snow::makeCluster(2, type="MPI")
      on.exit(snow::stopCluster(cl))
      registerDoSNOW(cl)
      do.i &lt;- function(i) lapply(seq_len(length(x)), function(l) mean(x[l], ...))
      foreach(i=seq_len(10)) %dopar% { do.i(i) }
  }
  x &lt;- rnorm(20)
  r &lt;- doForeach(x, trim=1)
  </code></pre>
  
  <p>I'd guess that it comes from the fact that the workers/slaves do not see the <code>...</code> anymore. Formal arguments are typically passed as character vectors via <code>.export=c("&lt;arg&gt;")</code>, but that does not seem to work for <code>...</code> arguments.</p>
  
  <p>What's the correct way of dealing with <code>...</code> arguments in this example?</p>