title: Using embedded do.call() in Shiny
body: <p>I'm trying to use Shiny+ShinyBS to create a collapsable panels with contains a bunch of column values per column.
  However, I'm having trouble in applying do.call correctly (or in the sequence I want)</p>
  
  <p>source code for server.R</p>
  
  <pre><code>require(shiny)
  library(lazyeval)
  library(shinyBS)
  
  l &lt;- lapply(mtcars,function(x)unique(x))
  
  shinyServer(function(input, output) {
    output$plot &lt;- renderUI({    
      col_list&lt;- lapply(1:length(l), function(i) {
        col &lt;- l[[i]]
        a&lt;- lapply(1:min(length(col),10), function(j) {
          interp(quote(bsToggleButton(nm,lb)),.values=list(nm=paste0(names(l)[i],'_val_', j),lb=col[j]))
        })
        pars &lt;- list(inputId =paste0('btng_',names(l)[i]), label = '', value = '',a)
  
        interp(quote(bsCollapsePanel(names(l)[i],
                                     fluidRow(
                                       column(4,               
                                              do.call(bsButtonGroup,unlist(pars))
                                       )
                                     ),id=nm,value=val)),.values=list(i=i,nm=paste0('test_',i),val='')
        )
      })
      pars2 &lt;- list(multiple = TRUE, open = "test_1", id = "collapse1",col_list)
      do.call(bsCollapse,unlist(pars2))
    })
  })
  </code></pre>
  
  <p>source code for ui.R</p>
  
  <pre><code>require(shiny)
  shinyUI(
    fluidPage(
      uiOutput('plot')
    )
  )
  </code></pre>
  
  <p>The code is NOT runnable, the problem is 'pars' seems to be static, it only contains the value of first iteration. I know there should be some better way to do this, please provide code if you figured it out, thanks!</p>