Chapitre 1: Cours Rmarhdown

I Situation des cas et décès de méningite

1. Cas

La situation épidémiologique de la méningite est marquée par le nombre élevé de SP dans le District sanitaire de Batié

library(pacman)
library(readxl)
library(dplyr)
library(janitor)
library(lubridate)
library(stringr)
library(gtsummary)
library(gt)
library(tidyverse)
library(flextable)
library(officer)
library(writexl)
library(cardx)
library(sf)
library(RColorBrewer)
library(ggspatial)
library(patchwork)
library(readxl)
library(pacman)
library(readxl)
library(dplyr)
library(janitor)
library(lubridate)
library(stringr)
library(gtsummary)
library(gt)
library(tidyverse)
library(flextable)
library(officer)
library(writexl)
library(cardx)
library(sf)
library(RColorBrewer)
library(ggspatial)
library(patchwork)
library(readxl)
library(pacman)
library(readxl)
library(dplyr)
library(janitor)
library(lubridate)
library(stringr)
library(gtsummary)
library(gt)
library(tidyverse)
library(flextable)
library(officer)
library(writexl)
library(cardx)
library(sf)
library(RColorBrewer)
library(ggspatial)
library(patchwork)
library(readxl)
library(pacman)
library(readxl)
library(dplyr)
library(janitor)
library(lubridate)
library(stringr)
library(gtsummary)
library(gt)
library(tidyverse)
library(flextable)
library(officer)
library(writexl)
library(cardx)
library(sf)
library(RColorBrewer)
library(ggspatial)
library(patchwork)
library(readxl)

Ce bloc décrit l’ensemble de package nécessaire

Base_Men25 <- read_excel("C:/Users/gnada/OneDrive/Desktop/Formation/Rstudio/Base_Men25.xlsx")
head(Base_Men25)

#1. Import de la base de données excel Calcul du nombre de cas de méningite notifiés par district

cas_district=Base_Men25%>%group_by(District)%>%
  summarise(cas=n())
# affichage du tableau
#knitr::kable(cas_district)
# Affichage du tableau dynamique, en html uniquement
DT::datatable(cas_district)

Ce tableau decrit le nombre de cas de méningite par disctrict
Le district de Banfora a notifié 120 cas en 2025

#I. Chapitre 2: Graphique avec ggplot2 ##1. Diagramme circulaire

cas_par_Sexe <- Base_Men25 %>%
  filter(!is.na(Sexe)) %>%
  count(Sexe, name = "nb_cas") %>%
  mutate(
    pourcentage = round(nb_cas / sum(nb_cas) * 100),
    etiquette = paste0
      (pourcentage, "%")
    )
# Ajouter une position pour placer les étiquettes
cas_par_Sexe <- cas_par_Sexe %>%
  arrange(desc(Sexe))

ggplot(cas_par_Sexe, aes(x = "", y = nb_cas, fill = Sexe)) +
  geom_bar(stat = "identity", width = 1, color = "white") +
  coord_polar("y", start = 0) +
  geom_text(aes(label = etiquette), color = "white", size = 5,position = position_stack(vjust = 0.5)) +
  scale_fill_manual(
    values = c(
      "M" = "deepskyblue2",
      "F" = "deeppink1"
    )
  ) +
  labs(
    title = "Repartition des cas de meningite selon le sexe",
    fill = "Sexe"
  ) +
  theme_void()