Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
propre.ecln
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DREAL Pays de la Loire
Centre de Services de la Donnée
propre.ecln
Commits
30fc6406
Commit
30fc6406
authored
1 year ago
by
Daniel.Kalioudjoglou
Browse files
Options
Downloads
Patches
Plain Diff
fin du calcul des indicateurs
parent
39eb74e0
No related branches found
No related tags found
1 merge request
!4
debut de script de secretisation
Pipeline
#203375
failed
1 year ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data-raw/01_preparation.R
+2
-27
2 additions, 27 deletions
data-raw/01_preparation.R
data-raw/04_regroupement_calage.R
+1
-1
1 addition, 1 deletion
data-raw/04_regroupement_calage.R
data-raw/05_creation_donnees_annuelles.R
+11
-20
11 additions, 20 deletions
data-raw/05_creation_donnees_annuelles.R
with
14 additions
and
48 deletions
data-raw/01_preparation.R
+
2
−
27
View file @
30fc6406
...
@@ -332,25 +332,6 @@ indic_nat <- ECLN2 %>%
...
@@ -332,25 +332,6 @@ indic_nat <- ECLN2 %>%
filter
(
TypeZone
!=
"Communes"
)
%>%
filter
(
TypeZone
!=
"Communes"
)
%>%
mutate_if
(
is.character
,
as.factor
)
mutate_if
(
is.character
,
as.factor
)
# # calcul total (individuel + collectif)
# indic_nat_tot <- nature_proj %>%
# group_by(TypeZone,Zone,CodeZone,Periode) %>%
# summarise(
# mev_t = sum(mev_t, na.rm = T),
# nb_resa = sum(nb_resa, na.rm = T),
# stock_fin = sum(stock_fin, na.rm = T),
# prix = sum(prix, na.rm = T),
# surface = sum(surface, na.rm = T)
# ) %>%
# ungroup() %>%
# mutate(id_nature_projet = "3",
# id_nature_projet = as.factor(id_nature_projet))
#
#
# # regroupement individuel, collectif et total
# nature_proj <-bind_rows(ondic_nat,indic_nat_tot)
# 2.2.b calculs par rapport au nombre de promoteurs
# 2.2.b calculs par rapport au nombre de promoteurs
...
@@ -458,14 +439,8 @@ rm(regroup_nat_resa_epci,regroup_nat_resa_dept,regroup_nat_resa_reg,regroup_nat_
...
@@ -458,14 +439,8 @@ rm(regroup_nat_resa_epci,regroup_nat_resa_dept,regroup_nat_resa_reg,regroup_nat_
regroup_nat_stock_epci
,
regroup_nat_stock_dept
,
regroup_nat_stock_reg
,
regroup_nat_stock_fra
,
regroup_nat_stock_epci
,
regroup_nat_stock_dept
,
regroup_nat_stock_reg
,
regroup_nat_stock_fra
,
regroup_par_nat_resa
,
regroup_par_nat_stock
,
regroup_par_nat_resa
,
regroup_par_nat_stock
,
b_dept
,
b_epci
,
b_france
,
b_reg
,
b_dept
,
b_epci
,
b_france
,
b_reg
,
regroup_nat_resa_ne
,
regroup_nat_stock_ne
)
regroup_nat_resa_ne
,
regroup_nat_stock_ne
,
ECLN
,
ECLN2
,
regroup_par_typ_resa_t
,
regroup_par_typ_stock_t
)
# Liste des Epci de plus de 50.000 habitants-----------------------------------------------------------
# Liste des Epci de plus de 50.000 habitants-----------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
data-raw/04_regroupement_calage.R
+
1
−
1
View file @
30fc6406
...
@@ -191,4 +191,4 @@ Indic_final <- bind_rows( ecln_regroup %>%
...
@@ -191,4 +191,4 @@ Indic_final <- bind_rows( ecln_regroup %>%
rm
(
cale
,
Cale_cons
,
Cale_cons_dep
,
Cale_cons_nat
,
Cale_cons_reg
,
Cale_typ
,
Cale_typ_dep
,
rm
(
cale
,
Cale_cons
,
Cale_cons_dep
,
Cale_cons_nat
,
Cale_cons_reg
,
Cale_typ
,
Cale_typ_dep
,
Cale_typ_nat
,
Cale_typ_reg
,
cale_reg_dep
,
Indic_cale
,
Indic_a_caler
)
Cale_typ_nat
,
Cale_typ_reg
,
cale_reg_dep
,
Indic_cale
,
Indic_a_caler
)
rm
(
ecln_publique
,
ecln_secret20
,
Cale_typ_tot
,
ecln_regroup
)
This diff is collapsed.
Click to expand it.
data-raw/05_creation_donnees_annuelles.R
+
11
−
20
View file @
30fc6406
#
library(RcppRoll)
library
(
RcppRoll
)
#
#
# # Calcul données annuelles----
# # Calcul données annuelles----
#
#
...
@@ -15,13 +15,6 @@
...
@@ -15,13 +15,6 @@
#
#
# ecln_avec_annuel <- bind_rows(Indic_final,ecln_annuel)
# ecln_avec_annuel <- bind_rows(Indic_final,ecln_annuel)
#
# 5. Calcul des indicateurs annuels glissants
# 5. Calcul des indicateurs annuels glissants
# -----------------------------------------------------------------
# -----------------------------------------------------------------
...
@@ -34,9 +27,11 @@ indicateurs_non_sommables <- str_subset(levels(Indic_final$Indicateur), "Encours
...
@@ -34,9 +27,11 @@ indicateurs_non_sommables <- str_subset(levels(Indic_final$Indicateur), "Encours
# On ajoute une colonne valeur_cumul qui correspond au cumul annuel glissant sauf pour les encours = valeur du trimestre
# On ajoute une colonne valeur_cumul qui correspond au cumul annuel glissant sauf pour les encours = valeur du trimestre
Indic_final2
<-
Indic_final
%>%
Indic_final2
<-
Indic_final
%>%
lazy_dt
()
%>%
arrange
(
TypeZone
,
CodeZone
,
Indicateur
,
Periode
)
%>%
# lazy_dt() %>%
group_by
(
TypeZone
,
Zone
,
CodeZone
,
Indicateur
)
%>%
group_by
(
TypeZone
,
Zone
,
CodeZone
,
Indicateur
)
%>%
mutate
(
Valeur_cumul
=
Valeur
+
lag
(
Valeur
)
+
lag
(
Valeur
,
2
)
+
lag
(
Valeur
,
3
))
%>%
mutate
(
Valeur_cumul
=
Valeur
+
lag
(
Valeur
)
+
lag
(
Valeur
,
2
)
+
lag
(
Valeur
,
3
))
%>%
# mutate(Valeur_cumul = roll_sumr(Valeur,4)) %>% # additionne les 4 derniers trimestres. NA si au moins un trimestre = NA
ungroup
()
%>%
ungroup
()
%>%
mutate
(
Valeur_cumul
=
ifelse
(
Indicateur
%in%
indicateurs_non_sommables
,
Valeur
,
Valeur_cumul
))
%>%
mutate
(
Valeur_cumul
=
ifelse
(
Indicateur
%in%
indicateurs_non_sommables
,
Valeur
,
Valeur_cumul
))
%>%
as_tibble
()
as_tibble
()
...
@@ -46,14 +41,9 @@ Indic_final2<- Indic_final %>%
...
@@ -46,14 +41,9 @@ Indic_final2<- Indic_final %>%
# ----------------------------------------------------
# ----------------------------------------------------
# L'objectif est de calculer :
# L'objectif est de calculer :
# - des indicateurs annuels glissants et de différencier les indicateurs trimestriels / annuels
# - des indicateurs annuels glissants et de différencier les indicateurs trimestriels / annuels
# - des taux d'évolution sur 12 mois pour chauqe indicatzeur
# - des taux d'évolution sur 12 mois pour chauqe indicateur
# - d'autres indicateurs
# - d'autres indicateurs:
# PrixM2_Maisons = Prix_Maisons / Surface_Maisons,
# PrixM2_Maisons,PrixM2_Appartements,PrixM2_Logements,PrixPar_Maisons,PrixPar_Appartements,PrixPar_Logements
# PrixM2_Appartements = Prix_Appartements / Surface_Appartements,
# PrixM2_Logements = Prix_Logements / Surface_Logements,
# PrixPar_Maisons = Prix_Maisons / Ventes_Maisons,
# PrixPar_Appartements = Prix_Appartements / Ventes_Appartements,
# PrixPar_Logements
# Dans la table finale, on aura la source, le type de l'indicateur (trimestriel, annuel)
# Dans la table finale, on aura la source, le type de l'indicateur (trimestriel, annuel)
...
@@ -106,7 +96,7 @@ indic_ecln_cumul <- Indic_final2 %>%
...
@@ -106,7 +96,7 @@ indic_ecln_cumul <- Indic_final2 %>%
TauxEvolution12Mois
<-
function
(
.data
)
{
TauxEvolution12Mois
<-
function
(
.data
)
{
.data
%>%
.data
%>%
arrange
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
)
%>%
arrange
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
,
Periode
)
%>%
select
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
,
Periode
,
Valeur
)
%>%
select
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
,
Periode
,
Valeur
)
%>%
group_by
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
)
%>%
group_by
(
Source
,
TypeZone
,
Zone
,
CodeZone
,
TypeIndicateur
,
Indicateur
)
%>%
mutate
(
TauxEvolution12Mois
=
round
(
100
*
Valeur
/
lag
(
Valeur
,
4
)
-
100
,
1
))
%>%
mutate
(
TauxEvolution12Mois
=
round
(
100
*
Valeur
/
lag
(
Valeur
,
4
)
-
100
,
1
))
%>%
...
@@ -115,8 +105,9 @@ TauxEvolution12Mois <- function(.data) {
...
@@ -115,8 +105,9 @@ TauxEvolution12Mois <- function(.data) {
indic_ecln_cumul
<-
TauxEvolution12Mois
(
indic_ecln_cumul
)
indic_ecln_cumul
<-
TauxEvolution12Mois
(
indic_ecln_cumul
)
indic_ecln_trim
<-
TauxEvolution12Mois
(
indic_ecln_trim
)
indic_ecln_trim
<-
TauxEvolution12Mois
(
indic_ecln_trim
)
indic_ecln
_non_secret
<-
bind_rows
(
indic_ecln_cumul
,
indic_ecln_trim
)
%>%
indic_ecln
<-
bind_rows
(
indic_ecln_cumul
,
indic_ecln_trim
)
%>%
mutate_if
(
is.character
,
as.factor
)
%>%
mutate_if
(
is.character
,
as.factor
)
%>%
mutate
(
TypeZone
=
fct_relevel
(
TypeZone
,
"France"
,
"Régions"
,
"Départements"
,
"Epci"
))
mutate
(
TypeZone
=
fct_relevel
(
TypeZone
,
"France"
,
"Régions"
,
"Départements"
,
"Epci"
))
indic_ecln
<-
indic_ecln_non_secret
rm
(
indicateurs_non_sommables
,
Indic_final2
,
Indic_final
,
indic_ecln_trim
,
indic_ecln_cumul
,
TauxEvolution12Mois
,
FormatDate
,
FormatCaractere
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment