title: Leaflet/shiny: cannot draw reactive polygons
body: <p>Having looked through the <a href="https://rstudio.github.io/leaflet/shiny.html" rel="nofollow noreferrer">Shiny integration example on the Leaflet for R page</a>, I am having trouble subsetting and displaying some polygons for display in my shiny app.</p>
  
  <p>At the moment, i'm getting a app, with sidebar, but the main display is simply "Error:Don't know how to get path data from object of class reactive"</p>
  
  <p>The idea is to pick a country polygon from GB (3 countries) and display it alone, depending on the drop down choice;</p>
  
  <pre><code>require(shiny)
  require(rgdal)
  require(rgeos)
  require(leaflet)
  
  cont &lt;- readOGR(".\\mypath\\mypolygons.shp", "mypolygons", stringsAsFactors=FALSE)
  
  ui &lt;- fluidPage(
  
    titlePanel("My page"),
  
    sidebarLayout(
      sidebarPanel(
        selectInput("countryInput", "Country:", choices = c('England','Scotland','Wales'))
      ),
      mainPanel(
        leafletOutput("mymap")
      )
    )
  )
  
  server &lt;- function(input, output, session) {
  
  pols &lt;- eventReactive(input$countryInput,{cont[substr(cont@data$code,1,1)==substr(input$countryInput,1,1),]})
  
    output$mymap &lt;- renderLeaflet({
      leaflet() %&gt;%
        addProviderTiles("CartoDB.Positron") %&gt;%
        addPolygons(data = pols)
    })
  }
  
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>Warning: Error in polygonData.default: Don't know how to get path data from object of class reactive
  Stack trace (innermost first):
      83: polygonData.default
      82: polygonData
      81: derivePolygons
      80: addPolygons
      79: function_list[[k]]
      78: withVisible
      77: freduce
      76: _fseq
      75: eval
      74: eval
      73: withVisible
      72: %&gt;%
      71: func [#6]
      70: output$mymap
       4: &lt;Anonymous&gt;
       3: do.call
       2: print.shiny.appobj
       1: &lt;Promise&gt;
  </code></pre>