enter image description hereI have a map in a shiny, where some filters are made, through selectinput. I need the filters in each box to work independently. In my current code, I was unable to establish this independence. I don't think I'm using the if / else correctly. I need you to help me evaluate if the if / else is being used correctly.
#### Mapa ####
filtered <- reactive({
filter(places_df,INDIGENA == input$INDIGENA)
if(input$INDIGENA == 'Todos' & input$POSSUI.ENERGIA == 'Todos'){
places_df}
else{
filter(places_df,INDIGENA == input$INDIGENA & POSSUI.ENERGIA == input$POSSUI.ENERGIA)
}
})
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