title: R Shiny: passing multiple, succesive reactives to selectInput
body: <p>I've been trying to extend the second solution posted by Ramnath (the one using <code>updateSelectInput</code>) in the problem originally posted at <a href="https://stackoverflow.com/questions/21465411/r-shiny-passing-reactive-to-selectinput-choices">R shiny passing reactive to selectInput choices</a>  .  I'd like to allow the user to select inputs from a hierarchical series of inputs where the choice in each selection updates the possible values in the next selection.  As an example, in the following I modify Ramnath's code by simply adding a third input that lists the values of the variable selected in the second input.  This example is based on the <code>mtcars</code> and <code>iris</code> datasets, and was run on R v 3.1.1 and RStudio v 0.98.1062.  It doesn't throw an error but you'll see that I'm stuck on how to add a second <code>reactive()</code> that takes as its input a combination of <code>input$dataset</code> and <code>input$column</code>.</p>
  
  <pre><code>library(shiny)
  
  runApp(list(
  
    ui = bootstrapPage(
      selectInput('dataset', 'Choose data set', c('mtcars', 'iris')),
      selectInput('columns', 'Choose variable', ""),
      selectInput('values', 'Show values', "")
    ),
  
    server = function(input, output, session){
  
      # updates variable names based on selected dataset 
      outVar = reactive({
        names(get(input$dataset))
      })
  
      # i want this to update the values of the selected variable
      outVar2 = reactive({
        sort(unique(get(input$dataset)[, 2]))  # this works but of course I don't want the second variable every time
        #sort(unique(get(input$dataset)[, input$columns]))   # this fails but this is the idea I'm after
      })
  
      # i want these to update the UI based on the reactive output above 
      observe({
        updateSelectInput(session, "columns", choices = outVar())
        updateSelectInput(session, "values", choices = outVar2())
      })       
    }
  ))
  </code></pre>