Last active
November 8, 2021 05:30
-
-
Save Valexandre/b360be386663ede9b5e6bad222b5404a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
#import des données spatiales | |
ContoursCommunes<-st_read("https://raw.githubusercontent.com/Valexandre/france-geojson/raw/master/communes.geojson")%>%st_transform(crs2154) | |
arr<-st_read("https://raw.githubusercontent.com/Valexandre/france-geojson/master/arrondissements-millesimes0.geojson")%>%st_transform(crs=2154) | |
DepsMetro<-st_read("https://raw.githubusercontent.com/Valexandre/france-geojson/master/departements.geojson")%>% | |
filter(nchar(code)==2)%>% | |
st_transform(crs=2154) | |
DonneesComm<- read_delim(https://datavaccin-covid.ameli.fr/explore/dataset/donnees-de-vaccination-par-commune/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B, | |
";", escape_double = FALSE, col_types = cols(commune_residence = col_character()), trim_ws = TRUE) | |
#on trie les semaines | |
dernieredate<-sort(DonneesCOmm$semaine_injection,decreasing = T)[1] | |
DonneesComm<-DonneesComm%>% | |
filter(semaine_injection==dernieredate) | |
#on joint avec le spatial pour les communes | |
COMMVACC<-DonneesComm%>%left_join(Comms%>%dplyr::select(INSEE_COM,geometry),by=c("commune_residence"="code")) | |
#on joint avec le spatial pour les arrondissements, en commençant par Lyon | |
COMMVACC2<-DonneesComm%>%left_join(arr%>%dplyr::select(code_insee,geometry)%>% | |
mutate(code_insee=as.character(code_insee)),by=c("commune_residence"="code_insee"))%>% | |
filter(substr(commune_residence,1,2)=="69")%>%st_as_sf()%>%st_transform(crs=2154) | |
TotalVaccCom<-rbind(COMMVACC,COMMVACC2)%>% | |
filter(substr(commune_residence,1,2)%in%c(69))%>% | |
st_as_sf() | |
#On vérifie les bornes pour qu'elles soient à peu près égales | |
cut(TotalVaccCom$taux_cumu_1_inj,5) | |
#carte pour Lyon et le 69 | |
TotalVaccCom%>% | |
ggplot()+ | |
geom_sf(aes(fill=cut(taux_cumu_1_inj*100,breaks=c(0,33,40,45,50,55,70))),colour="#FFFFFF")+theme_map()+ | |
labs(title="Le niveau de la vaccination autour de Lyon", | |
subtitle="Part de la population communale ayant reçu au moins une dose de vaccin", | |
caption="Données Ameli, code @humeursdevictor pour Le Parisien")+ | |
geom_sf(data=DepsMetro%>%filter(code==69),fill=NA,colour="#222222",size=1)+ | |
theme(legend.position = "top",text=element_text(size=20))+ | |
scale_fill_brewer("Taux de primoinjection", palette="Blues") | |
# on fait Marseille | |
COMMVACC2<-DonneesComm%>%left_join(arr%>%dplyr::select(code_insee,geometry)%>% | |
mutate(code_insee=as.character(code_insee)),by=c("commune_residence"="code_insee"))%>% | |
filter(substr(commune_residence,1,2)=="13")%>%st_as_sf()%>%st_transform(crs=2154) | |
TotalVaccCom<-rbind(COMMVACC,COMMVACC2)%>% | |
filter(substr(commune_residence,1,2)%in%c(13))%>% | |
st_as_sf() | |
TotalVaccCom%>% | |
ggplot()+ | |
geom_sf(aes(fill=cut(taux_cumu_1_inj*100,breaks=c(0,33,40,45,50,55,70))),colour="#FFFFFF")+theme_map()+ | |
labs(title="Le niveau de la vaccination autour de Marseille", | |
subtitle="Part de la population communale ayant reçu au moins une dose de vaccin", | |
caption="Données Ameli, code @humeursdevictor pour Le Parisien")+ | |
geom_sf(data=DepsMetro%>%filter(code==13),fill=NA,colour="#222222",size=1)+ | |
theme(legend.position = "top",text=element_text(size=20))+ | |
scale_fill_brewer("Taux de primoinjection", palette="Blues") | |
#Et la même pour la MGP | |
COMMVACC2<-DonneesComm%>%left_join(arr%>%dplyr::select(code_insee,geometry)%>% | |
mutate(code_insee=as.character(code_insee)),by=c("commune_residence"="code_insee"))%>% | |
filter(substr(commune_residence,1,2)%in%c(75,92:94)%>%st_as_sf()%>%st_transform(crs=2154) | |
TotalVaccCom<-rbind(COMMVACC,COMMVACC2)%>% | |
filter(substr(commune_residence,1,2)%in%c(75,92:94))%>% | |
st_as_sf() | |
TotalVaccCom%>% | |
ggplot()+ | |
geom_sf(aes(fill=cut(taux_cumu_1_inj*100,breaks=c(0,33,40,45,50,55,70))),colour="#FFFFFF")+theme_map()+ | |
labs(title="L'ouest parisien toujours plus vacciné", | |
subtitle="Part de la population communale ayant reçu au moins une dose de vaccin", | |
caption="Données Ameli, code @humeursdevictor pour Le Parisien")+ | |
geom_sf(data=DepsMetro_S%>%filter(INSEE_DEP%in%c(75,92,93,94)),fill=NA,colour="#222222",size=1)+ | |
theme(legend.position = "top",text=element_text(size=20))+ | |
scale_fill_brewer("Taux de primoinjection", palette="Blues") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment