Contexte. Ce document est une analyse statistique des soldats morts pour la France. Les données sont issues de Open Data Soft.
A la date du 09-12-2021, on dénombre 1 245 618 enregistrements.
library(dplyr)
library(ggplot2)
library(tidyr)
library(tidytext) # reorder_within
library(gt)
readLines("Data/morts-pour-la-france.csv",
n=5,
encoding="UTF-8")
## [1] "Nom;Prénom;Conflit;Date décès;Département de naissance;Nom département de naissance;Lien MémorialGenWeb"
## [2] "LACONDEMENE;Laurent Pierre;1914-1918;1918-02-13;0071;Saône-et-Loire;http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=1097400"
## [3] "LACOUR;Claude;1914-1918;1918-05-27;0071;Saône-et-Loire;http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=2557577"
## [4] "LACOUR;Jean Baptiste;1914-1918;1918-07-21;0071;Saône-et-Loire;http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=627594"
## [5] "LACROIX;François;1914-1918;1915-04-19;0071;Saône-et-Loire;http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=1794643"
dataset = read.table("Data/morts-pour-la-france.csv",
sep=";",
header=TRUE,
quote="\"",
encoding="UTF-8")
head(dataset)
str(dataset)
## 'data.frame': 1245618 obs. of 7 variables:
## $ Nom : chr "LACONDEMENE" "LACOUR" "LACOUR" "LACROIX" ...
## $ Prénom : chr "Laurent Pierre" "Claude" "Jean Baptiste" "François" ...
## $ Conflit : chr "1914-1918" "1914-1918" "1914-1918" "1914-1918" ...
## $ Date.décès : chr "1918-02-13" "1918-05-27" "1918-07-21" "1915-04-19" ...
## $ Département.de.naissance : int 71 71 71 71 71 71 71 71 71 71 ...
## $ Nom.département.de.naissance: chr "Saône-et-Loire" "Saône-et-Loire" "Saône-et-Loire" "Saône-et-Loire" ...
## $ Lien.MémorialGenWeb : chr "http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=1097400" "http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=2557577" "http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=627594" "http://www.memorialgenweb.org/memorial3/html/fr/complementter.php?id=1794643" ...
dataset %>% mutate(Date.décès = as.Date(Date.décès),
Conflit = as.factor(Conflit),
Nom.département.de.naissance = as.factor(Nom.département.de.naissance)) %>%
select(Prénom,Conflit,Date.décès,Nom.département.de.naissance) %>%
separate(col=Prénom,
into=c("Prénom1","Prénom2"),
sep=" ") %>%
select(-Prénom2) -> data
## Warning: Expected 2 pieces. Additional pieces discarded in 305168 rows [26, 29,
## 41, 60, 97, 108, 116, 128, 129, 132, 133, 139, 147, 152, 155, 165, 186, 193,
## 199, 213, ...].
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 398933 rows [2,
## 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 17, 18, 21, 22, 23, 24, 27, 31, 32, ...].
data %>% group_by(Conflit) %>%
summarize(Count = n()) %>%
arrange(desc(Count)) %>%
slice_head(n=5) %>%
ggplot(mapping = aes(x=reorder(Conflit,-Count),
y=Count/1000,
fill=Conflit)) +
geom_bar(stat="identity",
colour="black") +
geom_text(aes(label=Count),
vjust=-0.3)+
theme_bw()+
theme(legend.position = "none")+
labs(title="Top 5 des conflits les plus meurtriers pour l'armée française",
x="",y="Effectif (exprimé en milliers)")
data %>% mutate(Date = format(Date.décès,"%Y"),
Date = as.numeric(Date)) %>%
group_by(Date) %>%
summarize(Count=n()) %>%
filter(Date > 1850 & Date <=1970) %>%
ggplot(mapping = aes(x=Date,y=Count/1000))+
geom_line()+
scale_x_continuous(breaks = seq(1850,2021,by=10))+
theme_bw()+
theme(panel.border = element_blank())+
labs(title="Répartition des décès pas année",
x="",y="Effectif (exprimé en milliers)")
data %>% filter(Conflit == "1914-1918") %>%
group_by(Date.décès) %>%
summarize(Count=n()) %>%
filter(Date.décès >= as.Date("1914-07-28") & Date.décès <= as.Date("1918-11-11")) %>%
ggplot(mapping = aes(x=Date.décès,
y=Count))+
geom_line()+
scale_x_date(date_breaks = "6 months",date_labels = "%m-%Y")+
theme_bw()+
theme(panel.border=element_blank(),
plot.title = element_text(hjust=0.5))+
labs(title="Nombre de décès journalier",
x="",y="Effectif")
data %>% filter(Conflit == "1914-1918") %>%
group_by(Date.décès) %>%
summarize(Count=n()) %>%
filter(Date.décès >= as.Date("1914-07-28") & Date.décès <= as.Date("1918-11-11")) %>%
arrange(desc(Count)) %>%
slice_head(n=5) %>%
gt() %>% tab_header(
title = "Nombre de morts journalier pour le conflit 1914-1918",
subtitle ="Top 10 des journées les plus meurtières "
)
| Nombre de morts journalier pour le conflit 1914-1918 | |
|---|---|
| Top 10 des journées les plus meurtières | |
| Date.décès | Count |
| 1915-09-25 | 17359 |
| 1914-08-22 | 16874 |
| 1914-08-20 | 8113 |
| 1917-04-16 | 8075 |
| 1914-08-28 | 6390 |
data %>% group_by(Conflit,Prénom1) %>%
filter(Conflit != "" & Conflit != "??") %>%
summarize(Count = n()) %>%
arrange(desc(Count)) %>%
slice(1:5) %>%
filter(Conflit %in% c("1870-1871","1914-1918","1939-1945","Indochine","Guerre d'Algérie")) %>%
ggplot(mapping = aes(x=Prénom1,
y=Count,
fill=Prénom1))+
geom_bar(stat="identity",
colour="black")+
facet_wrap(~Conflit,scales = "free")+
labs(title="Répartition des soldats tués selon leur prénom",
x="",y="Effectif")+
theme_bw()+
theme(legend.position = "none")
## `summarise()` has grouped output by 'Conflit'. You can override using the `.groups` argument.
* Top 5 des départements les plus endeuillés par conflit.
data %>% group_by(Conflit,Nom.département.de.naissance) %>%
filter(Conflit != "" & Conflit != "??") %>%
filter(Conflit %in% c("1870-1871","1914-1918","1939-1945","Indochine","Guerre d'Algérie")) %>%
summarize(Count = n()) %>%
slice(n=1:5) %>% ggplot(mapping = aes(x=reorder_within(Nom.département.de.naissance,Count,Conflit),
y=Count,
fill=Nom.département.de.naissance))+
geom_bar(stat="identity",
colour="black",
show.legend=FALSE)+
facet_wrap(~Conflit,
scale="free")+
scale_x_reordered()+
coord_flip()
## `summarise()` has grouped output by 'Conflit'. You can override using the `.groups` argument.