Skip to content
Snippets Groups Projects
Commit eda700e6 authored by Daniel.Kalioudjoglou's avatar Daniel.Kalioudjoglou
Browse files

modification scripts suite a chargement nouvelles donnees

parent e07922d7
1 merge request!43Resolve "mise a jour donnees DK octobre 2024"
......@@ -20,6 +20,9 @@
# https://www.insee.fr/fr/statistiques/fichier/7631446/TD_PRINC30M_2020_csv.zip
# paru le 27/06/2023
# 2021 --> https://www.insee.fr/fr/statistiques/8202355?sommaire=8202874
# https://www.insee.fr/fr/statistiques/fichier/8202355/TD_PRINC30M_2021_csv.zip
# paru le 27/06/2024
# librairies ----------
library(tidyverse)
......@@ -32,19 +35,19 @@ rm(list = ls())
# chargement data et calcul -------
download.file(url = "https://www.insee.fr/fr/statistiques/fichier/7631446/TD_PRINC30M_2020_csv.zip",
destfile = "extdata/BTT_TD_PRINC30M_2020.zip")
unzip("extdata/BTT_TD_PRINC30M_2020.zip", overwrite = TRUE, exdir = "extdata")
BTT_TD_PRINC30M_2020 <- read.csv2("extdata/TD_PRINC30M_2020.csv",
download.file(url = "https://www.insee.fr/fr/statistiques/fichier/8202355/TD_PRINC30M_2021_csv.zip",
destfile = "extdata/BTT_TD_PRINC30M_2021.zip")
unzip("extdata/BTT_TD_PRINC30M_2021.zip", overwrite = TRUE, exdir = "extdata")
BTT_TD_PRINC30M_2021 <- read.csv2("extdata/TD_PRINC30M_2021.csv",
dec='.',
header = TRUE,
sep=";",
stringsAsFactors = FALSE,
encoding = "UTF-8")
date = 2020
date = 2021
combustible_2020 <- BTT_TD_PRINC30M_2020 %>%
combustible_2021 <- BTT_TD_PRINC30M_2021 %>%
filter(NIVGEO == "COM") %>%
select (-NIVGEO , -LIBGEO) %>%
group_by(CODGEO, CMBL, TYPLR) %>%
......@@ -81,7 +84,7 @@ combustible_old <- importer_data(db = "datamart",
schema = "portrait_territoires",
table = "source_combustible_principal_rp") # 2017
combustible <- bind_rows(combustible_old, combustible)
combustible <- bind_rows(combustible_old, combustible_2021)
# versement dans le sgbd/datamart.portrait_territoires et metadonnées -------------
......
......@@ -12,18 +12,18 @@ rm(list = ls())
# paramètre ---------
date = 2020
date = 2021
# chargement data ------------
# chargement des données : https://www.insee.fr/fr/statistiques/7632973?sommaire=7632977
# chargement des données : https://www.insee.fr/fr/statistiques/8200836?sommaire=8205947&q=D%C3%A9placement+domicile%2Ftravail+en+2021
# fichier BTT_TD_NAV2B
# NAV2 – Population active de 15 ans ou plus ayant un emploi par sexe, lieu de travail (géographie urbaine)
# et moyen de transport (Paru le : 27/06/2023)
racine_nom_fich <- paste0("extdata/TD_NAV2B_", date)
download.file(url = "https://www.insee.fr/fr/statistiques/fichier/7632973/TD_NAV2B_2020_csv.zip",
download.file(url = "https://www.insee.fr/fr/statistiques/fichier/8200836/TD_NAV2B_2021_csv.zip",
destfile = paste0(racine_nom_fich, ".zip"))
unzip(paste0(racine_nom_fich, ".zip"), overwrite = TRUE, exdir = "extdata")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment