title: reactiveValues cannot be used to render output
body: <p>I'm developing a shiny app using reactive value, of course. However, I'd like to explore the use of <code>reactiveValues</code> to test my understanding of the concept. My design is to create a <code>dt</code> container of reactive values, e.g. <code>data</code>, <code>cols</code>, <code>rows</code>; so that I can save shiny <code>input$file</code> uploaded data to <code>dt$data</code>; also I'd use <code>checkboxGroupInput</code> to display the columns of the data, which is saved as <code>dt$cols</code>, and let users to select columns and then render data table of <code>dt$data[dt$cols]</code>. Here's the code I used:</p>
  
  <pre><code>dt &lt;- reactiveValues()
  observeEvent(input$uploadbutton, {
  
         file &lt;- input$file
         req(input$file)
         f &lt;- read.csv(file$datapath, header = TRUE)
         dt$data &lt;- f
  
         # get the col names of the dataset and assign them to a list
         cols &lt;- mapply(list, names(dt$data))
  
         # update columns ui under columnscontrol div
         updateCheckboxGroupInput(session, "columns", "Select Columns:", choices = cols, selected = cols)
  })
  
  observeEvent(input$columns, { dt$cols &lt;- input$columns  })
  
  output$datatbl &lt;- DT::renderDataTable(
     dt$data[dt$cols], rownames = FALSE,
     # column filter on the top
     filter = 'top', server = TRUE,
     # autoWidth
     options = list(autoWidth = TRUE)
  )
  </code></pre>
  
  <p>The code didn't work, I was thrown with the error of "undefined columns" when <code>dt$data[dt$cols]</code> is called. However, the above works fine if I only use reactive value <code>dt2 &lt;- eventReactive(input$columns, { f &lt;- dt$data[input$columns], f })</code> and then call <code>dt2()</code> in <code>renderDataTable()</code>. I wonder what's wrong with the use of the variables in <code>reactiveValues</code>. </p>