Sur l’idée du plotly des origines, on explore les 10 origines les plus courantes sur chacun des departements, et on avise du meilleur regroupement en catégories aggrégées : Est-ce “dep_limitrophes”, “dep_2éme_couronne”, “dep_lointains”, “pays_limitrophes”, “pays_lointains” ou bien tout autre chose…
top_20_orig_lst <- map(levels(par_origines_td$dep_dest), ~par_origines_td %>% filter(dep_dest==.x) %>% group_by(dep_org) %>% summarise(top_20_orig = sum(volume)) %>% arrange(desc(top_20_orig) ) %>% top_n(20)) %>% setNames(levels(par_origines_td$dep_dest))
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
## Selecting by top_20_orig
top_20_orig_df <-enframe(top_20_orig_lst, name = "dep_dest", value = "top_dep_orig")
print(top_20_orig_lst)
## $`09`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 269860
## 2 GB 259258
## 3 NL 241410
## 4 ES+PT 240661
## 5 33 197595
## 6 34 182702
## 7 DE 160880
## 8 BE+LU 150641
## 9 13 142945
## 10 75 129149
## 11 44 98348
## 12 31 90038
## 13 82 84799
## 14 94 72730
## 15 92 70392
## 16 64 66844
## 17 85 63852
## 18 77 62258
## 19 30 62245
## 20 DK+SE+NO 60832
##
## $`11`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 GB 2435889
## 2 DE 1286481
## 3 Autres 1144845
## 4 ES+PT 1007522
## 5 BE+LU 682324
## 6 NL 474797
## 7 DK+SE+NO 406873
## 8 13 354412
## 9 69 311074
## 10 33 292669
## 11 75 288575
## 12 59 255806
## 13 38 234422
## 14 93 207178
## 15 78 197812
## 16 94 195432
## 17 92 195266
## 18 77 193371
## 19 91 191862
## 20 IT 191380
##
## $`12`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 31 508557
## 2 NL 462217
## 3 Autres 396124
## 4 DE 347250
## 5 75 303159
## 6 GB 274035
## 7 BE+LU 261652
## 8 13 249503
## 9 DK+SE+NO 244055
## 10 ES+PT 199069
## 11 92 195442
## 12 93 164823
## 13 94 161258
## 14 78 151873
## 15 91 148436
## 16 33 145858
## 17 69 141396
## 18 77 131644
## 19 95 125219
## 20 63 120246
##
## $`30`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 2138859
## 2 DE 1693882
## 3 BE+LU 1483686
## 4 NL 1073617
## 5 ES+PT 783003
## 6 69 743154
## 7 GB 701503
## 8 75 608418
## 9 DK+SE+NO 603428
## 10 CH 591878
## 11 38 503368
## 12 59 424324
## 13 IT 345527
## 14 92 341708
## 15 42 296212
## 16 94 288640
## 17 31 286204
## 18 78 285032
## 19 93 277797
## 20 33 257089
##
## $`31`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 7403741
## 2 DE 1788857
## 3 ES+PT 1498500
## 4 GB 1062427
## 5 BE+LU 904397
## 6 33 763517
## 7 DK+SE+NO 756032
## 8 75 658647
## 9 NL 653372
## 10 34 599542
## 11 IT 548492
## 12 13 472689
## 13 64 447116
## 14 92 441441
## 15 66 351775
## 16 94 332526
## 17 93 325599
## 18 69 319114
## 19 44 316170
## 20 US 312803
##
## $`32`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 719620
## 2 GB 494758
## 3 NL 406091
## 4 DE 258318
## 5 BE+LU 238078
## 6 33 184799
## 7 ES+PT 167166
## 8 75 157564
## 9 DK+SE+NO 131431
## 10 13 107755
## 11 34 104272
## 12 59 97899
## 13 92 90314
## 14 93 80963
## 15 78 78450
## 16 44 77312
## 17 91 72009
## 18 IT 70793
## 19 94 69105
## 20 77 67131
##
## $`34`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 4376348
## 2 DE 3618779
## 3 BE+LU 2321784
## 4 GB 2045869
## 5 NL 1876396
## 6 ES+PT 1678526
## 7 69 1563114
## 8 31 1314915
## 9 13 1294476
## 10 DK+SE+NO 1284505
## 11 38 1272357
## 12 75 1053466
## 13 59 954150
## 14 IT 787914
## 15 CH 774790
## 16 93 756498
## 17 42 733886
## 18 63 725714
## 19 77 689663
## 20 92 681118
##
## $`46`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 GB 602442
## 2 NL 492948
## 3 BE+LU 468649
## 4 31 455396
## 5 Autres 378165
## 6 DE 274911
## 7 75 268819
## 8 ES+PT 207470
## 9 33 197640
## 10 59 181301
## 11 92 181121
## 12 78 179740
## 13 91 171108
## 14 94 157915
## 15 93 147186
## 16 77 136946
## 17 DK+SE+NO 121570
## 18 44 119613
## 19 34 117973
## 20 95 117138
##
## $`48`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 13 237805
## 2 DE 191806
## 3 NL 172943
## 4 Autres 135852
## 5 69 121508
## 6 75 120704
## 7 63 106480
## 8 BE+LU 102906
## 9 92 95761
## 10 94 82982
## 11 ES+PT 79722
## 12 31 79700
## 13 91 72632
## 14 93 69862
## 15 78 63167
## 16 DK+SE+NO 62672
## 17 84 62096
## 18 77 61000
## 19 33 55448
## 20 44 54606
##
## $`65`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 33 929803
## 2 ES+PT 911256
## 3 IT 762090
## 4 GB 740108
## 5 Autres 445319
## 6 44 360420
## 7 DE 308810
## 8 85 289398
## 9 17 270768
## 10 NL 261919
## 11 47 221939
## 12 40 220951
## 13 BE+LU 203332
## 14 75 189469
## 15 49 176461
## 16 16 169109
## 17 13 161953
## 18 34 155715
## 19 79 150308
## 20 35 140133
##
## $`66`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 ES+PT 3012094
## 2 Autres 2907786
## 3 DE 1581486
## 4 31 1450651
## 5 GB 1066328
## 6 BE+LU 1018745
## 7 34 958459
## 8 NL 913267
## 9 59 830907
## 10 DK+SE+NO 626705
## 11 13 591435
## 12 77 509831
## 13 33 501029
## 14 75 498952
## 15 69 483253
## 16 91 472190
## 17 62 454069
## 18 93 442018
## 19 92 420066
## 20 78 400531
##
## $`81`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 645479
## 2 GB 388607
## 3 DE 314063
## 4 ES+PT 246147
## 5 BE+LU 232893
## 6 NL 220515
## 7 DK+SE+NO 207166
## 8 13 191336
## 9 75 174240
## 10 33 161905
## 11 92 121856
## 12 IT 111202
## 13 64 103915
## 14 69 101451
## 15 93 100572
## 16 78 99137
## 17 94 98783
## 18 91 92166
## 19 95 82570
## 20 66 82169
##
## $`82`
## # A tibble: 20 x 2
## dep_org top_20_orig
## <fct> <dbl>
## 1 Autres 1266697
## 2 GB 402911
## 3 NL 331902
## 4 DE 295953
## 5 BE+LU 270266
## 6 ES+PT 263669
## 7 DK+SE+NO 206483
## 8 33 135641
## 9 75 124517
## 10 34 100435
## 11 IT 96028
## 12 92 95108
## 13 13 81501
## 14 59 75982
## 15 77 71696
## 16 93 67393
## 17 78 65774
## 18 66 63496
## 19 44 61850
## 20 64 61810