From 8817b47ca3425c7837d2156f209da0900fa88b25 Mon Sep 17 00:00:00 2001 From: wlangera Date: Thu, 8 Aug 2024 08:45:57 +0200 Subject: [PATCH] codig of grouped leaflet maps --- source/markdown/data_controle_2024.Rmd | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/markdown/data_controle_2024.Rmd b/source/markdown/data_controle_2024.Rmd index 59c3c8a7..11d38f99 100644 --- a/source/markdown/data_controle_2024.Rmd +++ b/source/markdown/data_controle_2024.Rmd @@ -508,7 +508,7 @@ for (j in sort(years)) { distinct(periode_in_jaar) %>% pull() - for (ronde in sort(unique(data$periode_in_jaar))) { + for (ronde in sort(periods)) { # Filter data for the current year and round circles <- outside_circles_new %>% filter(regio != "Oostelijke leemstreek", @@ -543,11 +543,17 @@ for (j in sort(years)) { } } +groups <- outside_observations_new %>% + filter(regio != "Oostelijke leemstreek", + regio != "Polders") %>% + distinct(jaar, periode_in_jaar) %>% + mutate(group = paste("Jaar:", jaar, "- Ronde:", periode_in_jaar)) %>% + pull(group) + # Add layer control to toggle visibility of the facets leaflet_map <- leaflet_map %>% addLayersControl( - overlayGroups = unique(paste("Jaar:", sort(unique(data$jaar)), "- Ronde:", - sort(unique(data$periode_in_jaar)))), + overlayGroups = groups, options = layersControlOptions(collapsed = FALSE) ) %>% addLegend(