Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 95-structure-et-contenu-de-la-publication-2025
  • dev
  • master
3 results

Target

Select target project
  • dreal-pdl/csd/propre.artificialisation
1 result
Select Git revision
  • 95-structure-et-contenu-de-la-publication-2025
  • dev
  • master
3 results
Show changes
Showing
with 58 additions and 70 deletions
......@@ -35,7 +35,7 @@ creer_graphe_5_2 <- function(millesime_obs_artif,code_reg) {
data <- observatoire_artificialisation %>%
COGiter::filtrer_cog(reg = code_reg) %>%
dplyr::filter(.data$TypeZone %in% c("R\u00e9gions","D\u00e9partements")) %>%
dplyr::select(.data$TypeZone,.data$Zone,.data$date,.data$flux_naf_artificialisation_total) %>%
dplyr::select( "TypeZone", "Zone", "date", "flux_naf_artificialisation_total") %>%
dplyr::arrange(.data$TypeZone,.data$Zone,.data$date) %>%
dplyr::mutate(simul=FALSE,
flux_naf_artificialisation_total = .data$flux_naf_artificialisation_total / 10000) %>%
......@@ -82,7 +82,7 @@ creer_graphe_5_2 <- function(millesime_obs_artif,code_reg) {
data_segment_departements = data_departements %>%
dplyr::filter(.data$date ==max(date)) %>%
dplyr::select(.data$TypeZone,.data$Zone,.data$date,.data$valeur_objectif,.data$valeur_tendance) %>%
dplyr::select( "TypeZone", "Zone", "date", "valeur_objectif", "valeur_tendance") %>%
dplyr::mutate(y = .data$valeur_objectif+0.5*(.data$valeur_tendance-.data$valeur_objectif),
rank = rank(.data$y),
nrow = max(dplyr::row_number()),
......@@ -92,7 +92,7 @@ creer_graphe_5_2 <- function(millesime_obs_artif,code_reg) {
{mapfactory::format_fr_nb(valeur_tendance-valeur_objectif,0)} ha en moins \u00e0 r\u00e9aliser"))
data_segment_region = data_region %>%
dplyr::filter(.data$date ==max(date)) %>%
dplyr::select(.data$TypeZone,.data$Zone,.data$date,.data$valeur_objectif,.data$valeur_tendance) %>%
dplyr::select( "TypeZone", "Zone", "date", "valeur_objectif", "valeur_tendance") %>%
dplyr::mutate(y = .data$valeur_objectif+0.5*(.data$valeur_tendance-.data$valeur_objectif),
position = .data$y,
label = glue::glue("**{Zone}** :
......
......@@ -63,11 +63,11 @@ creer_tableau_1_6 <- function(millesime_ocsge = NULL, millesime_population = NUL
TRUE ~ "")
) %>%
dplyr::rename ("population_n"="population_municipale") %>%
dplyr::select (-.data$date)
dplyr::select(-"date")
# table des seuils
seuil_population <- population %>%
dplyr::select (.data$CodeZone,.data$seuil_pop)
dplyr::select("CodeZone", "seuil_pop")
# preparation des donnees
......@@ -80,8 +80,8 @@ creer_tableau_1_6 <- function(millesime_ocsge = NULL, millesime_population = NUL
dplyr::mutate(date=lubridate::year(lubridate::as_date(.data$date)),
espace_naturel= .data$autre_surface_naturelle + .data$surface_en_eau + .data$surface_naturelle_boisee) %>%
COGiter::filtrer_cog(reg = code_reg) %>%
dplyr::select (.data$TypeZone,.data$Zone,.data$CodeZone,
.data$espace_naturel,.data$espace_agricole,.data$espace_artificialise) %>%
dplyr::select ("TypeZone", "Zone", "CodeZone",
"espace_naturel", "espace_agricole", "espace_artificialise") %>%
dplyr::filter(.data$TypeZone == "Communes")
ocsge3 <- ocsge2 %>%
......@@ -104,14 +104,14 @@ creer_tableau_1_6 <- function(millesime_ocsge = NULL, millesime_population = NUL
# donnees du tableau
data2 <- data1 %>%
dplyr::select (.data$seuil_pop,.data$dep,.data$variable,.data$taux) %>%
dplyr::select("seuil_pop", "dep", "variable", "taux") %>%
tidyr::pivot_wider(names_from = "variable", values_from = "taux", values_fill = 0) %>%
dplyr::left_join(COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select(.data$DEP, .data$NOM_DEP),
dplyr::filter(.data$REG == code_reg) %>%
dplyr::select("DEP", "NOM_DEP"),
by=c("dep"= "DEP")) %>%
dplyr::rename("Departement" = "NOM_DEP") %>%
dplyr::select (.data$seuil_pop, .data$Departement, .data$espace_artificialise, .data$espace_agricole, .data$espace_naturel)
dplyr::select("seuil_pop", "Departement", "espace_artificialise", "espace_agricole", "espace_naturel")
data <- data2 %>%
dplyr::group_by(.data$seuil_pop) %>%
......@@ -125,12 +125,7 @@ creer_tableau_1_6 <- function(millesime_ocsge = NULL, millesime_population = NUL
dplyr::arrange(.data$seuil_pop) %>%
dplyr::mutate(seuil_pop = as.character(.data$seuil_pop)) %>%
dplyr::mutate(seuil_pop = ifelse(.data$n == 1, .data$seuil_pop, "")) %>%
dplyr::select(.data$seuil_pop,
.data$Departement,
.data$espace_artificialise,
.data$espace_agricole,
.data$espace_naturel,
.data$nmax)
dplyr::select("seuil_pop", "Departement", "espace_artificialise", "espace_agricole", "espace_naturel", "nmax")
# Render a bar chart with a label on the left
......@@ -141,7 +136,7 @@ creer_tableau_1_6 <- function(millesime_ocsge = NULL, millesime_population = NUL
}
tableau_1_6 <- reactable::reactable(
data %>% dplyr::select(-.data$nmax),
data %>% dplyr::select(-"nmax"),
defaultPageSize = 100,
sortable = FALSE,
rowStyle = function(index) {
......
......@@ -33,6 +33,10 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
millesime_debut <- 2016
millesime_population_debut <- millesime_population - (millesime_stock_artif - millesime_debut)
dep_reg <- COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select("DEP", "NOM_DEP")
if (is.numeric(code_reg)) {
code_reg = as.character(code_reg)
}
......@@ -68,11 +72,11 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
TRUE ~ "")
) %>%
dplyr::rename ("population_n"="population_municipale") %>%
dplyr::select (-.data$date)
dplyr::select(-"date")
# table des seuils
seuil_population <- population %>%
dplyr::select (.data$CodeZone, .data$seuil_pop)
dplyr::select("CodeZone", "seuil_pop")
# preparation des donnees evolution_artificialisation
......@@ -92,15 +96,11 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::filter (.data$date == millesime_stock_artif) %>%
dplyr::group_by(.data$dep, .data$seuil_pop, .data$date) %>%
dplyr::summarise(surface_artificialisee = sum(.data$surface_artificialisee, na.rm = T),
surf_cadastree = sum(.data$surf_cadastree, na.rm = T)
) %>%
surf_cadastree = sum(.data$surf_cadastree, na.rm = T)) %>%
dplyr::ungroup() %>%
dplyr::left_join(COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select(.data$DEP, .data$NOM_DEP),
by=c("dep"= "DEP")) %>%
dplyr::left_join(dep_reg, by = c("dep"= "DEP")) %>%
dplyr::rename("Zone" = "NOM_DEP") %>%
dplyr::select(-.data$dep)
dplyr::select(-"dep")
evol_artif1_2 <- evol_artif1 %>%
dplyr::group_by(.data$seuil_pop, .data$date) %>%
......@@ -110,11 +110,11 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::ungroup() %>%
dplyr::mutate(Zone = COGiter::regions %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::pull(.data$NOM_REG))
dplyr::pull("NOM_REG"))
evol_artif1 <-dplyr::bind_rows(evol_artif1,evol_artif1_2) %>%
dplyr::select(.data$seuil_pop, .data$Zone, .data$date, .data$surface_artificialisee, .data$surf_cadastree) %>%
evol_artif1 <- dplyr::bind_rows(evol_artif1, evol_artif1_2) %>%
dplyr::select("seuil_pop", "Zone", "date", "surface_artificialisee", "surf_cadastree") %>%
dplyr::mutate (part_artificialisee_du_territoire_cadastre = paste0( round((.data$surface_artificialisee / .data$surf_cadastree)*100 , 1), " %"))
evol_artif2 <- evol_artif %>%
......@@ -124,12 +124,9 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::group_by(.data$dep, .data$seuil_pop, .data$date) %>%
dplyr::summarise(surface_artificialisee_ancienne = sum(.data$surface_artificialisee, na.rm = T)) %>%
dplyr::ungroup() %>%
dplyr::left_join(COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select(.data$DEP, .data$NOM_DEP),
by=c("dep"= "DEP")) %>%
dplyr::left_join(dep_reg, by=c("dep"= "DEP")) %>%
dplyr::rename("Zone" = "NOM_DEP") %>%
dplyr::select(-.data$dep)
dplyr::select(-"dep")
evol_artif2_2 <- evol_artif2 %>%
dplyr::group_by(.data$seuil_pop, .data$date) %>%
......@@ -139,8 +136,8 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::filter (.data$REG == code_reg) %>%
dplyr::pull(.data$NOM_REG))
evol_artif2 <-dplyr::bind_rows(evol_artif2,evol_artif2_2) %>%
dplyr::select(.data$seuil_pop, .data$Zone, .data$surface_artificialisee_ancienne)
evol_artif2 <- dplyr::bind_rows(evol_artif2,evol_artif2_2) %>%
dplyr::select("seuil_pop", "Zone", "surface_artificialisee_ancienne")
# preparation des donnees evol_population
......@@ -158,12 +155,9 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::group_by(.data$dep, .data$seuil_pop, .data$date) %>%
dplyr::summarise(population_municipale = sum(.data$population_municipale, na.rm = T)) %>%
dplyr::ungroup() %>%
dplyr::left_join(COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select(.data$DEP, .data$NOM_DEP),
by=c("dep"= "DEP")) %>%
dplyr::left_join(dep_reg, by = c("dep" = "DEP")) %>%
dplyr::rename("Zone" = "NOM_DEP") %>%
dplyr::select(-.data$dep)
dplyr::select(-"dep")
evol_popul1_2 <- evol_popul1 %>%
dplyr::group_by(.data$seuil_pop, .data$date) %>%
......@@ -171,10 +165,10 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::ungroup() %>%
dplyr::mutate(Zone = COGiter::regions %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::pull(.data$NOM_REG))
dplyr::pull("NOM_REG"))
evol_popul1 <-dplyr::bind_rows(evol_popul1, evol_popul1_2) %>%
dplyr::select(.data$seuil_pop, .data$Zone, .data$population_municipale)
dplyr::select("seuil_pop", "Zone", "population_municipale")
evol_popul2 <- evol_popul %>%
......@@ -184,12 +178,9 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::group_by(.data$dep, .data$seuil_pop, .data$date) %>%
dplyr::summarise(population_municipale_ancienne = sum(.data$population_municipale, na.rm = T)) %>%
dplyr::ungroup() %>%
dplyr::left_join(COGiter::departements %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::select(.data$DEP, .data$NOM_DEP),
by=c("dep"= "DEP")) %>%
dplyr::left_join(dep_reg, by=c("dep"= "DEP")) %>%
dplyr::rename("Zone" = "NOM_DEP") %>%
dplyr::select(-.data$dep)
dplyr::select(-"dep")
evol_popul2_2 <- evol_popul2 %>%
dplyr::group_by(.data$seuil_pop, .data$date) %>%
......@@ -197,10 +188,10 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
dplyr::ungroup() %>%
dplyr::mutate(Zone = COGiter::regions %>%
dplyr::filter (.data$REG == code_reg) %>%
dplyr::pull(.data$NOM_REG))
dplyr::pull("NOM_REG"))
evol_popul2 <-dplyr::bind_rows(evol_popul2, evol_popul2_2) %>%
dplyr::select(.data$seuil_pop, .data$Zone, .data$population_municipale_ancienne)
evol_popul2 <- dplyr::bind_rows(evol_popul2, evol_popul2_2) %>%
dplyr::select("seuil_pop", "Zone", "population_municipale_ancienne")
# regroupement des donnees
......@@ -222,18 +213,18 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
glue::glue("communes entre\n",pop_2," et ",pop_3, " habitants"),
glue::glue("communes de plus\nde ",pop_3," habitants")))) %>%
dplyr::arrange(.data$seuil_pop) %>%
dplyr::select (.data$seuil_pop,
.data$Zone,
.data$surf_cadastree,
.data$surface_artificialisee,
.data$population_municipale,
.data$evolution_surf_artificialisee,
.data$part_artificialisee_du_territoire_cadastre,
.data$tc_surfaces_artificialisees,
.data$tc_population,
.data$nb_annees_pour_doubler,
.data$surf_artif_par_hab_an_x,
.data$surf_artif_par_nouv_hab_entre_x_y)
dplyr::select("seuil_pop",
"Zone",
"surf_cadastree",
"surface_artificialisee",
"population_municipale",
"evolution_surf_artificialisee",
"part_artificialisee_du_territoire_cadastre",
"tc_surfaces_artificialisees",
"tc_population",
"nb_annees_pour_doubler",
"surf_artif_par_hab_an_x",
"surf_artif_par_nouv_hab_entre_x_y")
# separation des tableaux
......@@ -257,7 +248,7 @@ creer_tableau_6_1 <- function(millesime_stock_artif = NULL, millesime_population
tableau_6_1 <- data_regroupe %>%
dplyr::select(-.data$seuil_pop) %>%
dplyr::select(-"seuil_pop") %>%
knitr::kable("html", caption = "Tableau de synth\u00e8se",
digits= c(0,0,0,0,0,1,1,1,0,1,1),
align = "c",
......
utils::globalVariables(
globalVariables(
c("teruti","observatoire_artificialisation",".data","variable",".",
"valeur","etalement_urbain","observatoire_artificialisation_gk3",
"valeur", "valeur_ind", "etalement_urbain","observatoire_artificialisation_gk3",
"stock_artificialise","population_legale","ocsge","regions")
)
......@@ -30,7 +30,8 @@ propre.artificialisation permet de produire une publication régionale sur l'art
Pour l'installer :
```{r, eval=FALSE}
remotes::install_gitlab("dreal-datalab/propre.artificialisation")
remotes::install_gitlab(repo = "dreal-pdl/csd/propre.artificialisation",
host = "gitlab-forge.din.developpement-durable.gouv.fr")
```
Pour l'utiliser :
......
......@@ -20,7 +20,8 @@ sur l’artificialisation des sols.
Pour l’installer :
``` r
remotes::install_gitlab("dreal-datalab/propre.artificialisation")
remotes::install_gitlab(repo = "dreal-pdl/csd/propre.artificialisation",
host = "gitlab-forge.din.developpement-durable.gouv.fr")
```
Pour l’utiliser :
......
......@@ -15,7 +15,7 @@ millesime_ocsge <- millesimes %>% dplyr::filter (donnee == "ocsge") %>% pull ()
millesime_obs_artif <- millesimes %>% dplyr::filter (donnee == "observatoire_artificialisation") %>% pull ()
millesime_population <- millesimes %>% dplyr::filter (donnee == "population_legale") %>% pull ()
millesime_stock_artif <- millesimes %>% dplyr::filter (donnee == "stock_artificialise") %>% pull ()
millesime_debut <- 2016 #millesime debut stock artificialisation (fixe)
millesime_debut <- 2016 # millesime debut stock artificialisation (fixe)
# carte 1_3 (source OCSGE) ---------------
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type