title: In R data.table, reshape on multiple columns fails when args are passed as named lists
body: <p>In R data.table, it is possible to reshape on multiple columns by passing a list of column names (value.var=) along with a list of aggregation functions (fun.aggregate=). This works well when those lists are explicitly passed to the function arguments. It appears to result in an error condition if the lists are passed as variables.</p>
  
  <p>For example, lets create a data table <code>dt</code> as follows:</p>
  
  <pre><code>dt = data.table(x=sample(5,20,TRUE), y=sample(2,20,TRUE), 
                  z=sample(letters[1:2], 20,TRUE), d1 = runif(20), d2=1L)
  </code></pre>
  
  <p>The reshape operation on two columns, d1 and d1, works with arguments passed as follows:</p>
  
  <pre><code>dcast(dt, x + y ~ z, fun=list(sum, mean), value.var=list("d1", "d2"))
  </code></pre>
  
  <p>However, the same operations fails when arguments are passed as named variables.</p>
  
  <pre><code>funs = list(sum, mean)
  vars = list("d1", "d2")
  dcast(dt, x + y ~ z, fun=funs, value.var=vars)
  </code></pre>
  
  <p>The error message is:</p>
  
  <pre><code>Error in aggregate_funs(fun.call, lvals, sep, ...) : 
    When 'fun.aggregate' and 'value.var' are both lists, 'value.var' must be either of length =1 or =length(fun.aggregate)
  </code></pre>
  
  <p>Is this a bug, or am I going about this the wrong way? </p>
  
  <p>Update: Tried in R version 3.5.0 and data.table version 1.11.4 on Windows. In the actual scenario, my table has 171 columns and over 300,000 rows. The pivot operation involves 31 columns. I have unexpectedly encountered an error in trying to pass function arguments as variables instead of long "in situ" lists. I am looking for an explanation why this error condition occurs. Thank you!</p>