title: Create reactive selectInput - flexdashboard with Shiny
body: <p>I'm trying to make a reactive selectInput using Shiny in a flexdashboard document. </p>
  
  <ol>
  <li><p>My first <code>selectInput</code> selects the type of Zone in a Marine Park.</p>
  
  <pre><code>selectInput("Zone", label = "Marine Park Zoning:",
            choices = c("All", levels(EoTR$MarineParkZone)), selected = "All")
  </code></pre></li>
  <li><p>Then I use this input to create a reactive data frame with only the Zones selected in step 1.</p>
  
  <pre><code>zone.choices = reactive({
    if (input$Zone=="All"){
    select(EoTR, ReefName, MarineParkZone, MarineParkMgmtSection)
    }else{
    select(EoTR, ReefName, MarineParkZone, MarineParkMgmtSection)%&gt;%
    filter(MarineParkZone==input$Zone)}
  })
  </code></pre></li>
  <li><p>Then I try to use this reactive data frame to define my choices for the next <code>selectInput</code></p>
  
  <pre><code>reactive({
  selectInput("Reef", label = "Priority Reef:",
          choices = zone.choices()$ReefName, selected = "Arlington Reef (16-064)")
  })
  </code></pre></li>
  </ol>
  
  <p>When I run the document my second input displays a bunch of code instead of the select menu and therefore all the processes based from that selector fail.</p>
  
  <p>Below is some code that will reproduce the problem</p>
  
  <pre><code>---
  title: "Untitled"
  output: 
    flexdashboard::flex_dashboard:
      orientation: columns
      vertical_layout: fill
  runtime: shiny 
  ---
  ```{r}
  library(flexdashboard)
  library(dplyr)
  
  EoTR = data.frame(ReefName=c("Reef1", "Reef2", "Reef3", "Reef4"), 
                MarineParkZone=c("Fished", "Fished", "Un-Fished", "Un-Fished"))
  
  selectInput("Zone", label = "Marine Park Zoning:",
            choices = c("All", levels(EoTR$MarineParkZone)), selected = "All")
  
  zone.choices = reactive({
    if (input$Zone=="All"){
    select(EoTR, ReefName, MarineParkZone)
    }else{
    select(EoTR, ReefName, MarineParkZone)%&gt;%
    filter(MarineParkZone==input$Zone)}
  })
  
  reactive({
  selectInput("Reef", label = "Priority Reef:",
          choices = zone.choices()$ReefName, selected = "Reef1")
  })
  ```
  </code></pre>
  
  <p>I know it's probably something silly with how I'm defining my reactive input but I'd really appreciate any help on this.</p>
  
  <p>Cheers,</p>
  
  <p>Sam</p>