rm(list=ls())
library("prettydoc")
library("forcats")
library("epiDisplay")
library("factoextra")
library("atable")
library("knitr")
library("finalfit")
library("Hmisc")
library("viridis")
library("stringr")
library("ggplot2")
library("kableExtra")
library("lubridate")
library("dplyr")
library("ggthemes")
library("plotly")
# sessionInfo()tt <- read.csv2("https://www.data.gouv.fr/fr/datasets/r/6fadff46-9efd-4c53-942a-54aca783c30c",
as.is = FALSE) %>%
filter(!dep %in% c("971","972", "973" ,"974", "976"))
#
tt$jour <- ymd(tt$jour)
dd <- last(tt$jour)
dj <- format(dd, "%d %B %Y")mongg <- function(dd,
dx = jour,
dy = cas,
tit,
stit = "",
colx,
ytit = "n") {
pp <- ggplot(dd) +
aes(x = {{dx}},
y = {{dy}}) +
geom_line(size = 0.4) +
geom_smooth(
span = 0.3,
col = colx,
se = FALSE,
method = "loess"
) +
labs(title = paste0("<br>", tit),
subtitle = stit,
y = ytit) +
theme_light() +
theme(
plot.title = element_text(size = 16, face = "bold"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 12),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.position = "none"
)
ggplotly(pp, tooltip = c("all"))
}Visualisation des nouveaux cas hospitalisés pour COVID-19 sur les trois derniers mois (France métropolitaine uniquement, les départements d’outre-mer ayant une évolution complètement différente pour des raisons géographiques évidentes). Données issues de l’INVS (Santé publique France). La présentation met en avant la moyenne mobile. Graphiques des entrées à l’hôpital & en réanimation pour la France entière & le Val d’Oise.
Données à jour le 03 octobre 2021.
France entière
zzf <- tt %>%
group_by(jour) %>%
summarise(sum(incid_hosp))
names(zzf)[2] <- "cas"
titre <-
paste0("France (", dj, ") - nouvelles hospitalisations")
mongg(zzf,
tit = "France entière - nouvelles hospitalisations",
stit = "Depuis le début de l'épidémie",
colx = "red")mongg(tail(zzf, 122),
tit = "France entière - Trois derniers mois",
stit = "trois derniers mois",
colx = "blue")zz <- tt %>%
group_by(jour) %>%
summarise(sum(incid_rea))
names(zz)[2] <- "cas"
mongg(tail(zz, 122),
tit = "France - Admission réanimation",
stit = "trois derniers mois",
colx = "red")Moyenne hebdomadaire des admissions hospitalières
Le jour indiqué est le premier semaine soit, pour le dernier point, j-6.
tz <- NULL
dz <- NULL
zz <- tt %>%
group_by(jour) %>%
summarise(sum(incid_hosp))
nz <- rev(seq(length(zz$jour) - 6, 1, -7))
for (l in nz) {
l1 <- l + 6
tz <- c(tz, sum(zz[l:l1, 2]))
dz <- c(dz, zz$jour[l])
}
dz <- as.Date(dz, origin = "1970-01-01")
aa <- tibble(dz, tz)
names(aa) <- c("jour", "n")
sem <- aa %>%
ggplot() +
aes(x = jour, y = n) +
geom_line() +
geom_area(fill = "red", alpha = 0.4) +
labs(title = "Admissions hospitalières - Hebdo",
subtitle = "Moyennes hebdomadaires",
y = "n") +
theme_light() +
theme(
plot.title = element_text(size = 16, face = "bold"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 12),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.position = "none"
)
ggplotly(sem, tooltip = c("x", "label", "y"))Ratio réa/hospitalisation
Si le nouveau variant devenu majoritaire est plus grave, le ratio nb d’admission en réa / nb d’hospitalisation doit monter. À l’inverse si le vaccin protège des formes graves il devrait baisser. Une marge d’erreur est à prévoir car les admissions en réa sont souvent retardées par rapport à l’admission à l’hôpital d’où un flou. De plus les critère d’hospitalisation (générale ou en réanimation) varient selon le temps : on sera plus sélectif en période de stress par ex.
zzf <- tt %>%
group_by(jour) %>%
summarise(hosp = sum(incid_hosp),rea = sum(incid_rea)) %>%
mutate(cas = 100*rea/hosp)
titre <- paste0(dj, " admission réa / hospitalisation")
mongg(
tail(zzf, 122),
tit = titre,
stit = " Trois derniers mois",
colx = "red",
ytit = "%"
) Val d’Oise
zz <- tt %>%
dplyr::filter(dep == "95")
titre <- paste0("Val d'Oise (", dj, ") - admissions hôpital")
mongg(
tail(zz, 122),
dy = incid_hosp,
tit = titre,
stit = "trois derniers mois",
colx = "blue"
)zz <- tt %>%
dplyr::filter(is.element(dep, c(60, 95)))
titre <-
paste0("Val d'Oise + Oise (", dj, ") - admissions en réanimation")
mongg(
tail(zz, 122),
dy = incid_rea,
tit = titre,
stit = "trois derniers mois",
colx = "red"
)Variations hebdomadaires
zzf$hebdo <- wday(zzf$jour,week_start = 1, label = TRUE)
zzf$we <- ifelse((zzf$hebdo == "sam\\."| zzf$hebdo == "dim\\."),"Week_end", "Semaine")
#
pp <- zzf %>%
ggplot() +
aes(x = hebdo, y = cas, fill = we) +
geom_boxplot() +
labs(
title = "<br>Hospitalisations - France entière",
subtitle = "Variations hebdomadaires",
x = "Date",
y = "n"
) +
theme_tufte(ticks = TRUE) +
theme(
plot.title = element_text(size = 16, face = "bold"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 12, angle = 0),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.position = "none"
)
ppg <- ggplotly(pp, tooltip = c("all"))
ppgDépartements voisins
bb <- c(78, 95, 60, 27)
idf <- tt %>%
dplyr::filter(is.element(dep, bb), jour > "2020-08-31")
idf$dep <- as.factor(idf$dep)
bb <- c(78, 95, 60, 27)
pop <- c(1395000, 1105464, 780000, 541054)
dpt <- data.frame(bb, pop)
names(dpt) <- c("dep", "pop")
dpt$dep <- as.factor(dpt$dep)
pp <- left_join(idf, dpt, by = "dep") %>%
mutate(hosp = incid_hosp * 100000 / pop) %>%
mutate(dep = fct_drop(dep)) %>%
ggplot() +
aes(x = jour, y = hosp, col = dep) +
# geom_point(size = 0) +
geom_smooth(span = 0.3, se = FALSE) +
labs(title = paste0("Admissions hôpital"),
x = "Date",
y = "n/100 000 habitants") +
theme_light() +
theme(
plot.title = element_text(size = 16, face = "bold"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 12),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.position = "bottom"
)
ppd <- ggplotly(pp, tooltip = c("all"))
ppd