library(readr)
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggpubr)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Tonnages au cours du temps
donnees_base %>%
group_by(year,SECT_COD_SACROIS_NIV5)%>%
summarise(sum_MONTANT_EUROS_SACROIS = sum(MONTANT_EUROS_SACROIS, na.rm = TRUE)) %>%
ggplot(aes(x = year, y = sum_MONTANT_EUROS_SACROIS, group = SECT_COD_SACROIS_NIV5, color = SECT_COD_SACROIS_NIV5)) +
geom_line() + theme(legend.position = "none")
## `summarise()` has grouped output by 'year'. You can override using the `.groups` argument.

Cha_Fil_Lig_def %>%
group_by(year,SECT_COD_SACROIS_NIV5)%>%
summarise(sum_MONTANT_EUROS_SACROIS = sum(MONTANT_EUROS_SACROIS, na.rm = TRUE)) %>%
ggplot(aes(x = year, y = sum_MONTANT_EUROS_SACROIS, group = SECT_COD_SACROIS_NIV5, color = SECT_COD_SACROIS_NIV5)) +
geom_line() + theme(legend.position = "none")
## `summarise()` has grouped output by 'year'. You can override using the `.groups` argument.

new_cha <- Cha_Fil_Lig_def %>%
select(year,SECT_COD_SACROIS_NIV5,MONTANT_EUROS_SACROIS)
new_donnees <- donnees_base %>%
select(year,SECT_COD_SACROIS_NIV5,MONTANT_EUROS_SACROIS)
df<-new_cha %>%
bind_rows(new_donnees) %>%
group_by(year,SECT_COD_SACROIS_NIV5)%>%
summarise(sum_MONTANT_EUROS_SACROIS = sum(MONTANT_EUROS_SACROIS, na.rm = TRUE))
## `summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
gg3 <- ggplot(df, aes(x = year, y = sum_MONTANT_EUROS_SACROIS, group = SECT_COD_SACROIS_NIV5, color = SECT_COD_SACROIS_NIV5)) +
geom_line() + theme(legend.position = "none")
ggplotly(gg3)
Engin utilisés
donnees_base
summary(as.factor(donnees_base$ENGIN_COD))
## FPO FWR GEN GES GN GNC GND GNS GTN GTR LHM
## 940 3 76 1162 908 508 443 79575 6 106023 340
## LHP LLD LLS LNB LTL LVS MIS OTB OTM PS PS1
## 947 213 47279 11 836 3 2 185864 32 5117 4381
## PTB PTM
## 4119 8509
Cha_Fil_Lig_def
summary(droplevels(as.factor(Cha_Fil_Lig_def$ENGIN_COD)))
## DRB FDV FPO GEN GES GN GNC GND GNS GTN GTR
## 6149 3 9075 21784 3938 16769 1218 1101 392331 12045 295583
## HES LHM LHP LL LLD LLF LLS LNS LTL LVD LVS
## 5 143 4491 11847 13722 204 99873 76 3244 184 1695
## LX MIS OTB OTM OTT PS PS1 PT PTB PTM SB
## 55 2008 961352 3104 92351 19781 19223 8 5717 47334 161
## SDV TX SV DRH FIX SDN SSC SX FSN GNF
## 198 978 53 174 38 40 29 3894 7 2 19
## LNP OT TB FCN
## 2 7192 1408 2
gg1 <-ggplot(donnees_base, aes(x = ENGIN_COD)) +
geom_bar()
gg2 <-ggplot(Cha_Fil_Lig_def, aes(x = ENGIN_COD)) +
geom_bar()
ggarrange(gg1,gg2, ncol =1)
