-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
139 lines (114 loc) · 3.36 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
title: "Indicateurs de développement par continent"
format:
dashboard:
embed-resources: true
code-tools: true
theme: yeti
logo: "images/my_image.png"
nav-buttons:
- icon: twitter
href: https://twitter.com
- icon: github
href: https://github.com/RemiDumas/exemple_dashboard
---
```{r, packages}
#| echo: false
#| include: false
library('tidyverse')
library('gapminder')
library('knitr')
espVieFR <- gapminder %>%
filter(year == last(year), country == "France") %>%
pull(lifeExp)
pibhabFR <- gapminder %>%
filter(year == last(year), country == "France") %>%
pull(gdpPercap)
```
# Indicateurs
## Row {height = "65%"}
```{r}
#| component: valuebox
#| title: Espérance de vie en France
#| width: 15%
list(
icon = "heart-fill",
color = "info",
value = paste(round(espVieFR, 0), "ans")
)
```
```{r}
#| component: valuebox
#| title: PIB par français
#| width: 15%
list(
icon = "cash-coin",
color = "secondary",
value = paste(round(pibhabFR, 0), "$")
)
```
```{r, espvie_pib}
#| fig-width: 16
#| width: 70%
gapminder %>% filter(year == last(year)) %>%
ggplot(aes(x = gdpPercap, y = lifeExp, size = pop, color = continent)) +
geom_point(alpha = 0.5) +
scale_x_log10() +
scale_size_continuous(range = c(1,20)) +
facet_wrap(facets = "continent", nrow = 1) +
labs(
title = paste("Espérance de vie et PIB par habitant en", last(gapminder$year)),
x = "PIB/hab. ($)",
y = "Espérance de vie (ans)"
) +
theme_minimal(base_size = 20) +
theme(legend.position = "none",
panel.grid.minor = element_blank())
```
## Row {height = "35%"}
```{r, pop}
#| fig-width: 10
gapminder %>%
group_by(continent, year) %>%
summarise(pop = sum(pop, na.rm = T)) %>%
ggplot(aes(x = year, y = pop, color = continent)) +
geom_line() +
scale_y_log10(labels = scales::label_number(scale = 1e-6, suffix = " M")) +
labs(title = "Évolution de la population par continent",
caption = "Source: Gapminder",
color = "Continent",
y = "Population",
x = "Année") +
theme_minimal(base_size = 20)+
theme(panel.grid.minor = element_blank())
```
```{r, lifeExp}
#| fig-width: 10
gapminder %>%
group_by(continent, year) %>%
summarise(lifeExp = sum(pop*lifeExp, na.rm = T)/ sum(pop, na.rm = T)) %>%
ggplot(aes(x = year, y = lifeExp, color = continent)) +
geom_line() +
scale_y_continuous(labels = scales::label_number(scale = 1, suffix = " ans")) +
labs(title = "Évolution de l'espérance de vie par continent",
caption = "Source: Gapminder",
color = "Continent",
y = "Espérance de vie",
x = "Année") +
theme_minimal(base_size = 20)+
theme(panel.grid.minor = element_blank())
```
# Données
 Learn more about the Gapminder dataset at <https://www.gapminder.org/data/documentation/>
```{r, affich_gapminder}
kable(gapminder)
```
# A propos
D'après l'exemple de JJ Allaire:
- [Dépôt Github](https://github.com/jjallaire/gapminder-dashboard/)
- [Le dashboard](https://jjallaire.github.io/gapminder-dashboard/)
Plus d'infos sur les dashboard Quarto:
- [https://quarto.org/docs/dashboards/](https://quarto.org/docs/dashboards/)
- [https://quarto.org/docs/reference/formats/dashboard.html](https://quarto.org/docs/reference/formats/dashboard.html)
- [Vidéo de Melissa Van Bussel](https://www.youtube.com/watch?v=5zYrgRylkH0)
#