title: Passing an expression into `MoreArgs` of `mapply`
body: <p>I'm doing some programming using <code>dplyr</code>, and am curious about how to pass an expression as (specifically a <code>MoreArgs</code>) argument to <code>mapply</code>?</p>
  
  <p>Consider a simple function <code>F</code> that subsets a <code>data.frame</code> based on some <code>ids</code> and a <code>time_range</code>, then outputs a summary statistic based on some other column <code>x</code>.</p>
  
  <pre><code>require(dplyr)
  F &lt;- function(ids, time_range, df, date_column, x) {
      date_column &lt;- enquo(date_column)
      x &lt;- enquo(x)
      df %&gt;%
          filter(person_id %chin% ids) %&gt;%
          filter(time_range[1] &lt;= (!!date_column) &amp; (!!date_column) &lt;= time_range[2]) %&gt;%
          summarise(newvar = sum(!!x))
  }
  </code></pre>
  
  <p>We can make up some example data to which we can apply our function <code>F</code>.</p>
  
  <pre><code>person_ids &lt;- lapply(1:2, function(i) sample(letters, size = 10))
  time_ranges &lt;- lapply(list(c("2014-01-01", "2014-12-31"),
                             c("2015-01-01", "2015-12-31")), as.Date)
  
  require(data.table)
  dt &lt;- CJ(person_id = letters,
           date_col  = seq.Date(from = as.Date('2014-01-01'), to = as.Date('2015-12-31'), by = '1 day'))
  dt[, z := rnorm(nrow(dt))]  # The variable we will later sum over, i.e. apply F to.
  </code></pre>
  
  <p>We can successfully apply our function to each of our inputs.</p>
  
  <pre><code>F(person_ids[[1]], time_ranges[[1]], dt, date_col, z)
  F(person_ids[[2]], time_ranges[[2]], dt, date_col, z)
  </code></pre>
  
  <p>And so if I wanted, I could write a simple for-loop to solve my problem. But if we try to apply syntactic sugar and wrap everything within <code>mapply</code>, we get an error.</p>
  
  <pre><code>mapply(F, ids = person_ids, time_range = time_ranges, MoreArgs = list(df = dt, date_column = date_col, x = z))
  
  # Error in mapply... object 'date_col' not found
  </code></pre>