Food
[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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)

To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.