title: clearShapes() not working -- leaflet() for R
body: <p>I cannot figure out why <code>clearshapes()</code> is not working in my leaflet shiny program. I am trying to remove the existing circles and replace with a category that is selected based on the input check box that I have. However, what happens is that new circles are overlayed on top of the existing ones.</p>
  
  <p>Anyone encounter this before?</p>
  
  <pre><code>df = read.csv("mappingData.csv",header=T, sep =",")
  
  ui = fluidPage(
    checkboxGroupInput("set", label = "Pothole Reported by:",
                       choices = list("Citizens Connect App" = "Citizens Connect App", 
                                      "City Worker App" = "City Worker App",
                                      "Constituent Call" = "Constituent Call",
                                      "Self Service" = "Self Service",
                                      "Employee Generated" = "Employee Generated",
                                      "Not Available (Cambridge)" = "")),
  
    verbatimTextOutput("value"),
  
    leafletOutput("map")
  )
  
  
  server &lt;- function(input, output) {
  
    filteredDataCheck &lt;- reactive({
      # subset(df, Source == input$set)
      print(input$set)
    })
  
    output$value &lt;- renderPrint ({ filteredDataCheck() })
  
    filteredData &lt;- reactive({
      df[as.character(df$Source) == input$set, ]
    })
  
  
    output$map &lt;- renderLeaflet ({
      leaflet(df) %&gt;%
        setView(-71.083, 42.353, 13) %&gt;%
       addProviderTiles("Stamen.TonerLite", options = providerTileOptions(noWrap=T))
    })
  
    observe({
      leafletProxy("map", data = filteredData() ) %&gt;% clearShapes() %&gt;%
        addCircles(radius = 1, color = "red", group = "circles") %&gt;% clearShapes()
  
    })
  
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>