forked from InseeFrLab/funathon2024_sujet2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.R
47 lines (35 loc) · 1.12 KB
/
global.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Environment ----------------------------------
library(readr)
library(dplyr)
library(lubridate)
library(stringr)
library(sf)
library(ggplot2)
library(plotly)
library(gt)
library(leaflet)
library(bslib)
source("R/import_data.R")
source("R/create_data_list.R")
source("R/clean_dataframe.R")
source("R/divers_functions.R")
source("R/tables.R")
source("R/figures.R")
# Global variables ---------------------------
YEARS_LIST <- 2018:2022
MONTHS_LIST = 1:12
# Load data ----------------------------------
urls <- create_data_list("./sources.yml")
pax_apt_all <- import_airport_data(unlist(urls$airports))
pax_cie_all <- import_compagnies_data(unlist(urls$compagnies))
pax_lsn_all <- import_liaisons_data(unlist(urls$liaisons))
airports_location <- st_read(urls$geojson$airport)
liste_aeroports <- unique(pax_apt_all$apt)
default_airport <- liste_aeroports[1]
# OBJETS NECESSAIRES A L'APPLICATION ------------------------
trafic_aeroports <- pax_apt_all %>%
mutate(trafic = apt_pax_dep + apt_pax_tr + apt_pax_arr) %>%
filter(apt %in% default_airport) %>%
mutate(
date = as.Date(paste(anmois, "01", sep=""), format = "%Y%m%d")
)