shiny allowling users to choose which columns to display
<p>I am dabbling with the datatable feature in shiny and I am interested in creating a wellpanel or a sidepanel that lists all the columns of a datatable and allows users to choose which columns they want to see on the datatable.</p>

<p>Right now this code below displays all the columns of toy dataset <code>mtcars</code></p>

<pre><code>library(shiny)

runApp(list(
  ui = basicPage(
    h2('The mtcars data'),
    dataTableOutput('mytable')
  ),
  server = function(input, output) {
    output$mytable = renderDataTable({
      mtcars
    })
  }
))
</code></pre>

<p>I am interested in providing the users the ability to turn these columns either on or off using a checkbox </p>

<pre><code>  [1] "mpg"  "cyl"  "disp" "hp"   "drat"
  [6] "wt"   "qsec" "vs"   "am"   "gear"
  [11] "carb"
</code></pre>

<p>Any help on addressing this issue is much appriciated. Thanks in advance.</p>