title: I'm having trouble with R:Shiny and the observeEvent function
body: <p>I'm building a shiny app and having trouble with my observeEvent function. Unfortunately, it is supposed to work by slider input for dates. The app runs but when I change the date on the slider the same data keeps popping up over and over again. I believe its only the first couple of rows that are showing over and over again.</p>
  <p>this is my full code:</p>
  <pre><code>ui &lt;-  bootstrapPage(
    tags$style(type = &quot;text/css&quot;, &quot;#map {height: calc(100vh - 80px) !important;}&quot;,&quot;html, body {width:100%;height:100%}&quot;),
    leafletOutput(&quot;map&quot;),
    absolutePanel(top = 10, right = 10,
                  sliderInput(&quot;dateRange&quot;,
                               &quot;Dates:&quot;,
                               min = as.Date(&quot;2020-01-01&quot;,&quot;%Y-%m-%d&quot;),
                               max = as.Date(&quot;2020-12-01&quot;,&quot;%Y-%m-%d&quot;),
                               value=as.Date(&quot;2020-12-01&quot;),
                               timeFormat=&quot;%Y-%m-%d&quot;)
                              
          
    )
  )
  
  
  server &lt;- function(input, output) {
    
    result_data$Change1&lt;- cut(result_data$Change, 
                            c(-1,0,1,2,3,4), include.lowest = T,
                            labels = c('increasing', 'decreasing', 'undetectable','no data','test'))
    
    
    beatCol &lt;- colorFactor(palette = 'RdYlGn', result_data$Change1)
    
    
  
  
    map=leaflet() %&gt;%
        addProviderTiles(providers$Esri.WorldStreetMap) %&gt;%
        setView(lat = 47.2529, lng = -122.4443, zoom = 10) %&gt;%
        
    #overlay groups
        addLayersControl(
            overlayGroups = c(&quot;Basins&quot;,&quot;Testing sites&quot;, &quot;WWTP&quot;),
            position = c(&quot;bottomright&quot;),
            options = layersControlOptions(collapsed = FALSE))
    
   
    observeEvent(input$dateRange,
                 {
                   leafletProxy(&quot;map&quot;) %&gt;% 
                     clearMarkers()%&gt;%
                     addCircleMarkers(data = result_data, unique(result_data$Change), 
                                      lat = as.numeric(result_data$Latitude), 
                                      lng = as.numeric(result_data$Longitude), 
                                      weight = 1, 
                                      radius = 10,
                                      fillOpacity = 0.1, 
                                      color = ~beatCol(Change1),
                                      label = ~ as.character(Site),
                                      popup = ~ as.character(Site),
                                      
                                      )
    
                 }
                 
    )
    
    output$map &lt;- renderLeaflet({
  
      map
      
    })
    
  }
  
  shinyApp(ui, server)
  </code></pre>
  <p>I've tried to fix it by doing this instead with the observeEvent function.</p>
  <pre><code> rv &lt;- reactiveValues(
       filteredData =result_data,
       ids = unique(result_data$Change)
     )
  
     observeEvent(input$dateRange,
                  {
                    leafletProxy(&quot;map&quot;) %&gt;%
                      clearMarkers()%&gt;%
                      addCircleMarkers(data = subset(rv$filteredData, Change == rv$ids),
                                       lat = as.numeric(rv$filteredData$Latitude),
                                       lng = as.numeric(rv$filteredData$Longitude),
                                       weight = 1,
                                       radius = 10,
                                       fillOpacity = 0.1,
                                       color = ~beatCol(Change1),
                                       label = ~ as.character(Site),
                                       popup = ~ as.character(Site),
  
                                    )
                 }
    )
  </code></pre>
  <p>I still get the same issue.</p>
  <p>A snippet of the dataset that observeEvent is pulling from:</p>
  <pre><code>Site    Change          Date        Latitude    Longitude
  Basin C04 (MH-6761957)  1   2020-05-22  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-05-29  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-06-05  47.23513    -122.40374
  Basin C04 (MH-6761957)  1   2020-06-12  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-06-19  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-06-25  47.23513    -122.40374
  Basin C04 (MH-6761957)  1   2020-07-02  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-07-09  47.23513    -122.40374
  Basin C04 (MH-6761957)  2   2020-07-16  47.23513    -122.40374
  Basin C04 (MH-6761957)  1   2020-07-23  47.23513    -122.40374
  Basin C04 (MH-6761957)  1   2020-07-30  47.23513    -122.40374
  Basin C09 (MH-6754884) alt site 0   2020-05-15  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-05-22  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-05-29  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-06-05  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 1   2020-06-12  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 2   2020-06-19  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-06-25  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-07-02  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-07-09  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-07-16  47.22362    -122.442
  Basin C09 (MH-6754884) alt site 0   2020-07-23  47.22362    -122.442
  </code></pre>
  <p>I am just getting the first date for each site and then it never changes.</p>