title: Shiny Leaflet - Highlight polygon
body: <p>I have a simple shiny-app with just a dropdown listing districts of Afghanistan and a leaflet map of the same. <a href="https://i.stack.imgur.com/JGATY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JGATY.png" alt="enter image description here"></a></p>
  
  <p>The shape file can be accessed at this <a href="http://biogeo.ucdavis.edu/data/gadm2.8/shp/AFG_adm_shp.zip" rel="nofollow noreferrer">link</a> - using AFG_adm2.shp from <a href="http://www.gadm.org/download" rel="nofollow noreferrer">http://www.gadm.org/download</a></p>
  
  <p>here's the app code:</p>
  
  <pre><code>library(shiny)
  library(leaflet)
  library(rgdal)
  library(sp)
  
  afg &lt;- readOGR(dsn = "data", layer ="AFG_adm2", verbose = FALSE, stringsAsFactors = FALSE)
  
  ui &lt;- fluidPage(
      titlePanel("Test App"),
      selectInput("yours", choices = c("",afg$NAME_2), label = "Select Country:"),
      leafletOutput("mymap")
  
  )
  
  server &lt;- function(input, output){
    output$mymap &lt;- renderLeaflet({
      leaflet(afg) %&gt;% #addTiles() %&gt;%
         addPolylines(stroke=TRUE, color = "#00000", weight = 1) 
    })
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>I want the functionality that when I select a district from the dropdown list, the <strong>border fill of that district changes, and the setView function brings that district into focus</strong>. Can someone help me out with the code? I've looked at <a href="https://stackoverflow.com/questions/40290142/leaflet-polygons-change-style-upon-choosing-location-from-a-shiny-dropdown-menu">this</a> post but can't make much sense of it.</p>