I am currently building a dashboard in shiny that consists of a map with certain locations marked out with markers. I also have a pickerInput selection on my sidebar.
I'm trying to make it such that when the user selects a selection from the pickerInput, the marker corresponding to that input disappears.
below is my code: I am not sure how to proceeed
#dashboard page
main_page <- nav_panel(
"cafes",
card(
full_screen = TRUE,
card_header("Please select closed cafes."),
layout_sidebar(
sidebar = sidebar(pickerInput("Options", "Select cafes to Close:", choices = location, multiple = TRUE, options = list(container = 'body'))),
leafletOutput("map")
)
)
)
#displaying map
output$map <- renderLeaflet({
m <- leaflet() %>%
addTiles() %>%
setView(lng = default_longitude, lat = default_latitude, zoom = default_zoom)
#adding markers
m <- addMarkers(
m,
data = marker_data,
lng = ~lng,
lat = ~lat,
popup = popupGraph(p),
label = ~marker_data$location
#icon=marker_icon
)
i also have a marker_data dataframe with 3 columns: lat,lng,location.