R leaflet map - Change legends based on selected layer group
问题 I am making an R leaflet map (not Shiny) and I have two control groups, and based on the selection I would like a different legend to become visible. Currently I only manage to have both legends visible at all time. Below is the code for the leaflet map, and the output can be seen in the image. leaflet() %>% addSearchOSM() %>% addProviderTiles(providers$CartoDB.Positron, options = providerTileOptions(noWrap = TRUE), group = "kaart") %>% # addFullscreenControl() %>% addCircleMarkers(data =