Passing selectInput values to map
<p>I am trying to figure out how to use variables selected through selectInput on the UI side to populate the map data on the server side. Although I've had some success manually setting variables to show up through filteredData, it doesn't work properly for inputs that can dynamically change. Is there some function/solution that could help subset the data to show on the map based on user input?</p>

<p>UI.R</p>

<pre><code>districts &lt;- readOGR("location",layer)
metadata &lt;- read.csv("metadata.csv")

#Prepare list of values for the selectInput boxes
COMMUNITYSAFETY&lt;-as.list(metadata$variable[metadata$group == "Community Safety"])
names(COMMUNITYSAFETY)=metadata$description[metadata$group == "Community Safety"]

##CONTINUED FOR REST OF SELECTINPUT BOXES

ui &lt;- fluidPage(
  titlePanel("Map"),
  sidebarPanel(
    selectInput("vr", "Would you like to show the variable by value or rank?",
                c("Value" = "_v",
                  "Rank" = "_r")
    ),
    selectInput("group", "Select Group:",
                c("Community Safety" = "COMMUNITYSAFETY",
                  "Demographics" = "DEMOGRAPHICS",
                  "Healthy People and Environments" = "HEALTHY_PEOPLE_ENVM",
                  "Housing" = "HOUSING",
                  "Income and Employment" = "INCOME_EMPL",
                  "Lifelong Learning" = "LIFE_LEARNING",
                  "Transportation" = "TRANSPORTATION")),
    #if user choses Community Safety
    conditionalPanel(
      condition = "input.group == 'COMMUNITYSAFETY'",
      selectInput("var", "Community Safety Variables:",
                  COMMUNITYSAFETY)),

    #repeat other conditional panels for inputs

  mainPanel(
    tabsetPanel(  
      tabPanel("Map", leafletOutput("map", height=800)),
      tabPanel("Histogram")
))))
</code></pre>

<p>Server.R:</p>

<pre><code>server &lt;- function(input, output, session){
  filteredData &lt;- reactive({
    subset(districts,select=input$var)
  })

...

  observe({
    leafletProxy("map", data=districts) %&gt;%
      addPolygons(stroke=TRUE,
                  fillColor=pal(filteredData()),
                  color="black",
                  weight=.5)
  }) 
}
</code></pre>