title: using a function to renderUI(selectInput()) in Shiny app
body: <p>Here's server.r</p>
  
  <pre><code>server &lt;- function(input, output) {
    output$species &lt;- renderUI({
       selectInput("species", 
                   label = "blah", 
                   choices = as.list(unique(iris$Species)))
        })
  }
  </code></pre>
  
  <p>Then over in ui.r</p>
  
  <pre><code>ui &lt;- fluidPage(
     fluidRow(        
         uiOutput("species")
  )
  </code></pre>
  
  <p>This works as expected, a drop down select input appears like this:
  <a href="https://i.stack.imgur.com/uhtuO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uhtuO.png" alt="enter image description here"></a></p>
  
  <p>Since I have multiple features I need to create a similar filter for in my actual data frame, I tried to do the same with a function:</p>
  
  <p>In server.r</p>
  
  <pre><code>  outputFilters &lt;- function(id, df) {
      output$id &lt;- renderUI({
       selectInput(id, 
                   label = "blah", 
                   choices = as.list(unique(df$id)))
        })
    }
  
  outputFilters("species", iris)
  </code></pre>
  
  <p>Then in ui.r same as before <code>uiOutput("species")</code></p>
  
  <p>However, now no drop down appears. Presumably my function is flawed. How can I use a function to generate the drop downs?</p>