title: Using linked selectInput functions in Shiny
body: <p>New to Shiny and can't seem to find this inforamtion yet: I am making an app with two <code>selectInput</code> drop-downs such that the second (highlighted in yellow) is dependant on the first. </p>
  
  <p><a href="https://i.stack.imgur.com/kDpdN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kDpdN.png" alt="enter image description here"></a></p>
  
  <p>This is for data exploration and basically goes through different folder contents. Here's what I would like to have: </p>
  
  <pre><code>  ui &lt;- fluidPage(
    selectInput(inputId = "site", label = "Select Site", choices = dir(basepath)),
    selectInput(inputId = "duct", label = "Select Duct", 
                choices = dir(grep(input$site, dir(basepath, full.names = T), val = T)))
  )
  </code></pre>
  
  <p>The above code does not work, clearly. I am not sure how to use <code>input$site</code> in another input function. </p>
  
  <p>I found some answers: <a href="https://stackoverflow.com/questions/45063965/displaying-multiple-inputbox-on-selecting-multiple-variables-using-selectinput-f">Displaying multiple inputbox on selecting multiple variables using selectinput function in R Shiny</a> and <a href="https://stackoverflow.com/questions/26430253/using-conditionalpanel-in-shiny-ui-r-and-server-r-different-selectinput-based-o">using conditionalPanel in Shiny ui.R and server.R: different selectInput based on a condition</a> but they are not directly applicable since I don't have an exhaustive list of possible options for the first input (<code>inputId = "site"</code>).</p>