-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
107 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
library(arrow) | ||
library(dplyr) | ||
library(ggplot2) | ||
library(forcats) | ||
|
||
|
||
api_token <- Sys.getenv("JETON_API") | ||
bucket_formation <- "public" | ||
path_within_bucket <- "/ssplab-formation" | ||
|
||
|
||
source("R/functions_import.R", encoding = "UTF-8") | ||
source("R/functions_stats_desc.R", encoding = "UTF-8") | ||
source("R/functions_models.R", encoding = "UTF-8") | ||
|
||
|
||
# ENVIRONNEMENT DE STOCKAGE ------------------- | ||
|
||
bucket <- s3_bucket(bucket_formation, endpoint_override = Sys.getenv("AWS_S3_ENDPOINT")) | ||
bucket_path <- bucket$path(paste0(path_within_bucket, "/RPindividus")) | ||
|
||
|
||
# IMPORT ET STRUCTURATION DONNEES ------------- | ||
|
||
columns_subset <- c( | ||
"REGION", "AGED", "ANAI", "CATL", "COUPLE", | ||
"SEXE", "SURF", "TP", "TRANS", "IPONDI" | ||
) | ||
|
||
|
||
# Données recensement | ||
df <- import_recensement_subset( | ||
bucket_path, REGION = 24, cols = columns_subset | ||
) | ||
|
||
|
||
# Shapefile départements | ||
departements <- import_shapefile_departement( | ||
path = paste0(bucket_formation, "/", path_within_bucket) | ||
) | ||
|
||
print("Calcul de la part de seniors dans chaque département") | ||
part_seniors <- compute_part_seniors_by_dep(bucket_path) | ||
|
||
|
||
# STATISTIQUES AGREGEES --------------------------------------- | ||
|
||
|
||
calculer_stat_agregee(df |> filter(SEXE == "Homme") |> pull(AGED)) | ||
calculer_stat_agregee(df |> filter(SEXE == "Femme") |> pull(AGED)) | ||
|
||
|
||
# Pyramide des âges | ||
generer_pyramide_ages(df) | ||
|
||
# Modalités de transport par statut familial | ||
resultats_transport <- calculer_transport_par_statut(df) | ||
print(resultats_transport) | ||
|
||
# Part des hommes dans chaque cohorte | ||
plot_part_hommes <- calculer_part_hommes(df) | ||
print(plot_part_hommes) | ||
|
||
# Carte des seniors | ||
generer_carte_seniors(departements, part_seniors) | ||
|
||
|
||
# MODELISATION -------------------------------- | ||
|
||
print("Modélisation") | ||
modelisation_recensement(df) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters