Day 15 of 30DayMapChallenge : « food » (previously).
Results of State food controls in restaurants in La Réunion.
library(dplyr) library(sf) library(janitor) library(mapsf) library(glue) library(lubridate) # https://geoservices.ign.fr/adminexpress # COG dep <- read_sf("~/ADE-COG_2-1_SHP_WGS84G_FRA/DEPARTEMENT.shp") %>% filter(INSEE_DEP == "974") # https://dgal.opendatasoft.com/explore/dataset/export_alimconfiance/download/?format=shp alim <- read_sf("~/../Downloads/export_alimconfiance.shp") %>% clean_names() %>% filter(str_sub(code_postal, 1, 3) == "974") %>% mutate(date_inspec = ymd_hms(date_inspec), synthese_ev = factor(synthese_ev, levels = c("A corriger de manière urgente", "A améliorer", "Satisfaisant", "Très satisfaisant"))) alim %>% ggplot() + geom_sf(data = dep, fill = "grey90", color = "lightblue3") + geom_sf(aes(color = synthese_ev)) + scale_color_manual(values = c( "A corriger de manière urgente" = "red", "A améliorer" = "orange", "Satisfaisant" = "blue", "Très satisfaisant" = "green")) + labs(title = "Food quality control", subtitle = "La Réunion", color = "Control result", caption = glue("data: alim-confiance.gouv.fr {min(alim$date_inspec)} - {max(alim$date_inspec)} r.iresmi.net - {Sys.Date()}")) + theme_minimal() + theme(panel.background = element_rect(fill = "lightblue1"), plot.caption = element_text(size = 7)) ggsave("food.png", width = 20, height = 20, units = "cm", scale = 1.1)
