library(tidyverse)
library(here)
library(huxtable)
library(rnaturalearth)
library(tmap)
Charger les packages nécessaires
Télécharger les données
= here("data", "agr.rds") agr_path
::vroom("https://raw.githubusercontent.com/sternenklar/A-Good-Reason/main/Data/complete_data_compared.csv") |>
vroomwrite_rds(agr_path)
= read_rds(agr_path) agr
glimpse(agr)
Rows: 51,512
Columns: 15
$ date <date> 2020-01-01, 2020-01-02, 2020-01-03, 2020-01-04…
$ country <chr> "Albania", "Albania", "Albania", "Albania", "Al…
$ strictest_night <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
$ strictest_day <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
$ least_strict_night <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
$ least_strict_day <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
$ leave_municip <chr> "no", "no", "no", "no", "no", "no", "no", "no",…
$ change <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ source <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ stayhome_day <chr> "no", "no", "no", "no", "no", "no", "no", "no",…
$ stayhome_night <chr> "no", "no", "no", "no", "no", "no", "no", "no",…
$ walk_day <chr> "yes", "yes", "yes", "yes", "yes", "yes", "yes"…
$ walk_night <chr> "yes", "yes", "yes", "yes", "yes", "yes", "yes"…
$ outside_masks <chr> "no", "no", "no", "no", "no", "no", "no", "no",…
$ difference_with_oxcgrt <chr> "no", "no", "no", "no", "no", "no", "no", "no",…
Recoder
= agr |>
agr_mode filter(between(date, ymd(20200401), ymd(20200501))) |>
mutate(
least_strict_day = str_remove_all(least_strict_day, "b"),
least_strict_day = as.numeric(least_strict_day),
least_strict_day = case_when(
%in% 0:1 ~ "Sorties totalement libres",
least_strict_day %in% 2:3 ~ "Sorties à justifier",
least_strict_day %in% 4:5 ~ "Excercice physique limité",
least_strict_day %in% 6:7 ~ "Excercice physique interdit")
least_strict_day |>
) count(country, least_strict_day) |>
group_by(country) |>
filter(n == max(n)) |>
rename(mode_least_strict_day_april = least_strict_day) |>
select(-n) |>
mutate(
wb = countrycode::countrycode(country, origin = "country.name", destination = "wb")
|>
) filter(!country %in% c("Northern Cyprus"))
|>
agr_mode as_hux() |>
theme_bright()
country | mode_least_strict_day_april | wb |
Albania | Excercice physique interdit | ALB |
Andorra | Excercice physique interdit | AND |
Austria | Sorties à justifier | AUT |
Belarus | Sorties totalement libres | BLR |
Belgium | Sorties à justifier | BEL |
Bosnia and Herzegovina | Excercice physique interdit | BIH |
Bulgaria | Sorties totalement libres | BGR |
Croatia | Sorties totalement libres | HRV |
Cyprus | Excercice physique limité | CYP |
Czech Republic | Sorties à justifier | CZE |
Denmark | Sorties totalement libres | DNK |
Estonia | Sorties totalement libres | EST |
Finland | Sorties totalement libres | FIN |
France | Excercice physique limité | FRA |
Germany | Sorties totalement libres | DEU |
Greece | Excercice physique limité | GRC |
Hungary | Sorties à justifier | HUN |
Iceland | Sorties totalement libres | ISL |
Ireland | Excercice physique limité | IRL |
Italy | Excercice physique limité | ITA |
Kosovo | Excercice physique interdit | XKX |
Latvia | Sorties totalement libres | LVA |
Liechtenstein | Sorties totalement libres | LIE |
Lithuania | Sorties totalement libres | LTU |
Luxembourg | Sorties à justifier | LUX |
Malta | Excercice physique interdit | MLT |
Moldova | Excercice physique interdit | MDA |
Monaco | Sorties à justifier | MCO |
Montenegro | Excercice physique interdit | MNE |
Netherlands | Sorties totalement libres | NLD |
North Macedonia | Excercice physique interdit | MKD |
Norway | Sorties totalement libres | NOR |
Poland | Excercice physique interdit | POL |
Portugal | Excercice physique interdit | PRT |
Romania | Excercice physique interdit | ROU |
Russia | Sorties totalement libres | RUS |
San Marino | Excercice physique interdit | SMR |
Serbia | Excercice physique interdit | SRB |
Slovak Republic | Sorties totalement libres | SVK |
Slovenia | Sorties à justifier | SVN |
Spain | Excercice physique interdit | ESP |
Sweden | Sorties totalement libres | SWE |
Switzerland | Sorties totalement libres | CHE |
Turkey | Excercice physique interdit | TUR |
Ukraine | Excercice physique interdit | UKR |
United Kingdom | Sorties à justifier | GBR |
Cartographier
= ne_countries(continent = "europe", returnclass = "sf") europe_sf
= europe_sf |>
agr_mode_sf mutate(
wb = countrycode::countrycode(name, origin = "country.name", destination = "wb")
|>
) left_join(agr_mode, join_by(wb)) |>
select(country, wb, mode_least_strict_day_april)
|>
agr_mode_sf filter(country != "Russia") |>
ggplot() +
geom_sf(aes(fill = mode_least_strict_day_april)) +
labs(fill = "Situation en avril 2020") +
theme_void()
Citation
BibTeX
@online{boulakia2023,
author = {Boulakia, Théo and Mariot, Nicolas},
title = {L’Europe des promenades surveillées},
date = {2023-09-29},
url = {https://l-attestation.github.io/exercices/promenades-surveillees-europe/},
langid = {fr}
}
Veuillez citer ce travail comme suit :
Boulakia, Théo, and Nicolas Mariot. 2023. “L’Europe des promenades
surveillées.” September 29, 2023. https://l-attestation.github.io/exercices/promenades-surveillees-europe/.