title: Displaying data table in shiny app, columns displayed conditional on checkboxGroupInput
body: <p>I'm trying to render a Data table in a shiny app. When I pass it through without any conditional arguments it displays just fine. A problem arises when I try to make the displayed variables conditional on input from a checkBoxGroup widget.
  Here is the relevant part of my code:</p>
  
  <h1>server.R</h1>
  
  <pre><code>library(shiny)
  library(ggplot2)
  library(pander)
  library(plyr)
  
  load("data/ages.data.rda")
  load("data/test.data.rda")
  load("data/refine.data.rda")
  shinyServer(function(input, output) {
  
    output$tafla.gogn &lt;- renderDataTable({
  
  dataset &lt;- switch(input$data,
                    "study1" = ages.data,
                    "study2" = test.data
                   )
  dataset[,input$breytur, drop = F]
   }, options=list(pageLength=10, searchDelay=500))
  
  })
  </code></pre>
  
  <h1>ui.R</h1>
  
  <pre><code>shinyUI(navbarPage(img(src="logo.png"), theme="bootstrap.css",        collapsible=T, windowTitle="My research",
  tabPanel("Tables",
  sidebarLayout(
    sidebarPanel(
      #The problem arises when I try to use this widget, I suspect it has something to do with me calling the output$dataset.
      checkboxGroupInput("breytur", label="Hvaða dálka viltu sjá?", choices =  names("output$dataset"), selected = names("output$dataset")) 
    ),
    mainPanel(        
       h2("Selected data"),
       dataTableOutput("tafla.gogn")
  
       )
     )
     ))
    ))
  </code></pre>
  
  <p>When I run the app I get the error:
      Listening on [deleted]
      Error in mapply(ids, choices, names(choices), FUN = function(id, value,  : 
        zero-length inputs cannot be mixed with those of non-zero length
      Error in mapply(ids, choices, names(choices), FUN = function(id, value,  : 
        zero-length inputs cannot be mixed with those of non-zero length</p>
  
  <p>The data is loaded from .rda files as data.frames from within the data folder in my app.</p>