lundi 3 mai 2021

All in shiny selectinput

I have a map in shiny where I need to filter out indigenous and non-indigenous people. But I also need to filter out all indigenous and non-indigenous people. I am using selectinput.

filtered <- reactive({
      filter(places_df,INDIGENA == input$INDIGENA)

if(input$INDIGENA =='ALL')
places_df

    })

    output$MapPlot1 <- renderLeaflet({
      
        leaflet(data =  filtered())%>% 
        setView(-51.127166, -4.299999, 10)%>%  
        addTiles()%>%
        addMarkers(popup = paste0(places_df$ID.GRUPO.FAMILIAR, "</br>", places_df$LOCALIDADES))
    
    })
    
    
    observe(
      leafletProxy("MapPlot1", data = filtered ())%>%  
        clearMarkers()%>%  
        addMarkers(popup = paste0(places_df$ID.GRUPO.FAMILIAR, "</br>", places_df$LOCALIDADES))
      )
    

Aucun commentaire:

Enregistrer un commentaire