Commit 69449077 authored by David Nortes Martínez's avatar David Nortes Martínez
Browse files

first commit with map 'ensemble_personnes_rencontrees' already included

Showing with 59 additions and 0 deletions
+59 -0
```{r data-recup}
# chargement des bibliothèques
library(geau)
library(sf)
# declaration de parametres
output_path = "data-common/figure/so-ii/map/"
# Récupération des données (à faire une fois)
ent_prelim = rio::import("data-common/table/so-ii/membre_roi.ods", which = 1)
```
```{r entretien_prelim}
# traitement des données
## sous-ensemble de données
dataset = ent_prelim[,c("statut", "latitude", "longitude")]
## géolocalisation des données
dataset = dataset[!is.na(dataset[["latitude"]]), ]
dataset = sf::st_as_sf(dataset, coords = c("longitude", "latitude"), crs = "WGS84")
## mise en forme de la visualisation des données
### symboles et couleur des symboles
pch_agri = 24
pch_hab = 21
pch = rep(NA, nrow(dataset))
pch[dataset[["statut"]] == "agriculteur"] = pch_agri
pch[dataset[["statut"]] == "habitant"] = pch_hab
bg = rep("black", nrow(dataset))
col = rep("white", nrow(dataset))
### synthèse des données
total_agri = length(dataset[["statut"]][dataset[["statut"]] == "agriculteur"])
total_hab = length(dataset[["statut"]][dataset[["statut"]] == "habitant"])
## Légende Carte en cours
dataset_legend = list(
title = "Ensemble des personnes rencontrées",
legend = c(
sprintf("Agriculteur (%s)", total_agri),
sprintf("Habitant (%s)", total_hab)
),
pch = c(pch_agri,pch_hab),
pt.bg = "black",
pt.cex = 1.4
)
# Carte
map_so_ii(dataset,
dataset_legend,
theme = "clc",
pch = pch,
bg = bg,
col = col,
path = file.path(output_path, "ensemble_personnes_rencontrees.pdf"))
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment