Convert flight counts to connection list
Source:R/data_flights.R
flightCountMatrixToConnectionList.Rd
Convert a numeric matrix containing flight counts between airports to a data frame containing a list of connections.
Arguments
- nFlightsPerConnection
A square, numeric matrix with identical column- and row-names. Each entry represents the number of flights from the airport indexing the row to the airport indexing the column in some arbitrary time period.
- directed
Logical scalar. Whether flights A->B and B->A should be considered separately.
Value
A data frame with columns departureAirport
, arrivalAirport
, nFlights
.
Each row represents one connection with >=1 flights in the input matrix.
See also
Other flight data related topics:
flights
,
getFlightDelayData()
,
getFlightGraph()
,
plotFlights()
Examples
flightCountMatrixToConnectionList(flights$flightCounts[1:100, 1:100, 1])
#> departureAirport arrivalAirport nFlights
#> 1 ATL ABE 761
#> 2 CLE ABE 318
#> 3 CLT ABE 182
#> 4 CVG ABE 529
#> 5 AMA ABQ 214
#> 6 ATL ABQ 889
#> 7 BWI ABQ 215
#> 8 CLE ABQ 1
#> 9 CVG ABQ 370
#> 10 DAL ABQ 1078
#> 11 ATL ABY 627
#> 12 CEC ACV 179
#> 13 CVG ACY 464
#> 14 AKN ADK 54
#> 15 ANC ADQ 251
#> 16 BET ADQ 66
#> 17 ATL AEX 508
#> 18 ATL AGS 1541
#> 19 ADK AKN 62
#> 20 ANC AKN 157
#> 21 ATL ALB 1014
#> 22 BWI ALB 1086
#> 23 CLE ALB 545
#> 24 CLT ALB 406
#> 25 CVG ALB 552
#> 26 ABQ AMA 241
#> 27 DAL AMA 999
#> 28 ADQ ANC 394
#> 29 AKN ANC 128
#> 30 ATL ANC 91
#> 31 BET ANC 707
#> 32 CDV ANC 177
#> 33 ATL APF 467
#> 34 ABE ATL 617
#> 35 ABQ ATL 643
#> 36 ABY ATL 582
#> 37 AEX ATL 492
#> 38 AGS ATL 1381
#> 39 ALB ATL 787
#> 40 ANC ATL 53
#> 41 APF ATL 419
#> 42 ATW ATL 425
#> 43 AUS ATL 1281
#> 44 AVL ATL 1306
#> 45 AVP ATL 576
#> 46 AZO ATL 47
#> 47 BDL ATL 1700
#> 48 BHM ATL 1564
#> 49 BMI ATL 548
#> 50 BNA ATL 1269
#> 51 BOI ATL 137
#> 52 BOS ATL 3453
#> 53 BPT ATL 80
#> 54 BQK ATL 569
#> 55 BTR ATL 1287
#> 56 BTV ATL 41
#> 57 BUF ATL 1792
#> 58 BUR ATL 203
#> 59 BWI ATL 3351
#> 60 CAE ATL 1835
#> 61 CAK ATL 1716
#> 62 CHA ATL 1121
#> 63 CHO ATL 430
#> 64 CHS ATL 1486
#> 65 CLE ATL 1953
#> 66 CLT ATL 2568
#> 67 CMH ATL 675
#> 68 COS ATL 290
#> 69 CRP ATL 516
#> 70 CRW ATL 807
#> 71 CSG ATL 891
#> 72 CVG ATL 2122
#> 73 DAB ATL 1029
#> 74 DAY ATL 1642
#> 75 ATL ATW 636
#> 76 CVG ATW 475
#> 77 ATL AUS 1428
#> 78 BNA AUS 286
#> 79 BWI AUS 393
#> 80 CLE AUS 153
#> 81 COS AUS 1
#> 82 CVG AUS 635
#> 83 DAL AUS 1447
#> 84 ATL AVL 1293
#> 85 CVG AVL 478
#> 86 ATL AVP 767
#> 87 CVG AVP 402
#> 88 ATL AZO 42
#> 89 CVG AZO 869
#> 90 DAY AZO 1
#> 91 ALB BDL 1
#> 92 ATL BDL 1696
#> 93 BNA BDL 121
#> 94 BWI BDL 1496
#> 95 CLE BDL 536
#> 96 CLT BDL 1240
#> 97 CVG BDL 683
#> 98 ANC BET 583
#> 99 AVP BGM 1
#> 100 CVG BGM 443
#> 101 BOS BGR 1397
#> 102 CVG BGR 750
#> 103 ATL BHM 1608
#> 104 BNA BHM 508
#> 105 BWI BHM 545
#> 106 CLE BHM 54
#> 107 CLT BHM 231
#> 108 CVG BHM 950
#> 109 BZN BIL 1
#> 110 ATL BMI 743
#> 111 ATL BNA 1657
#> 112 AUS BNA 308
#> 113 BDL BNA 157
#> 114 BHM BNA 283
#> 115 BWI BNA 1274
#> 116 CLE BNA 915
#> 117 CLT BNA 831
#> 118 CMH BNA 299
#> 119 CVG BNA 1218
#> 120 ATL BOI 166
#> 121 ALB BOS 1
#> 122 ATL BOS 4083
#> 123 BGR BOS 1112
#> 124 BTV BOS 494
#> 125 BWI BOS 2252
#> 126 CAK BOS 340
#> 127 CLE BOS 712
#> 128 CLT BOS 2158
#> 129 CMH BOS 519
#> 130 CVG BOS 1431
#> 131 ATL BPT 116
#> 132 ATL BQK 721
#> 133 BZN BTM 1
#> 134 ATL BTR 1290
#> 135 CVG BTR 316
#> 136 ATL BTV 33
#> 137 BOS BTV 415
#> 138 CLE BTV 264
#> 139 CVG BTV 462
#> 140 ATL BUF 2199
#> 141 BWI BUF 1185
#> 142 CLE BUF 620
#> 143 CLT BUF 724
#> 144 CVG BUF 569
#> 145 ATL BUR 279
#> 146 COS BUR 1
#> 147 ABQ BWI 95
#> 148 ALB BWI 1034
#> 149 ATL BWI 3972
#> 150 AUS BWI 276
#> 151 BDL BWI 1342
#> 152 BHM BWI 444
#> 153 BNA BWI 1128
#> 154 BOS BWI 2182
#> 155 BUF BWI 1204
#> 156 CLE BWI 1168
#> 157 CLT BWI 1813
#> 158 CMH BWI 754
#> 159 CVG BWI 866
#> 160 DAY BWI 275
#> 161 ATL BZN 1
#> 162 BIL BZN 1
#> 163 ATL CAE 1703
#> 164 CVG CAE 1048
#> 165 ATL CAK 1883
#> 166 BOS CAK 268
#> 167 CVG CAK 1242
#> 168 BFL CDC 1
#> 169 ANC CDV 231
#> 170 ACV CEC 157
#> 171 ATL CHA 1180
#> 172 CVG CHA 583
#> 173 ATL CHO 560
#> 174 CVG CHO 401
#> 175 ATL CHS 1782
#> 176 CLT CHS 911
#> 177 CVG CHS 716
#> 178 CVG CID 488
#> 179 ABE CLE 238
#> 180 ABQ CLE 2
#> 181 ALB CLE 649
#> 182 ATL CLE 1998
#> 183 AUS CLE 142
#> 184 BDL CLE 581
#> 185 BHM CLE 22
#> 186 BNA CLE 1130
#> 187 BOS CLE 701
#> 188 BTV CLE 215
#> 189 BUF CLE 663
#> 190 BWI CLE 1365
#> 191 CLT CLE 589
#> 192 CMH CLE 386
#> 193 CVG CLE 1157
#> 194 DAB CLE 15
#> 195 DAY CLE 532
#> 196 ABI CLL 1
#> 197 ABE CLT 84
#> 198 ALB CLT 566
#> 199 ATL CLT 2909
#> 200 BDL CLT 1073
#> 201 BHM CLT 132
#> 202 BNA CLT 778
#> 203 BOS CLT 2003
#> 204 BUF CLT 782
#> 205 BWI CLT 1626
#> 206 CHS CLT 663
#> 207 CLE CLT 588
#> 208 CMH CLT 597
#> 209 CVG CLT 1388
#> 210 ATL CMH 1302
#> 211 BNA CMH 376
#> 212 BOS CMH 616
#> 213 BWI CMH 842
#> 214 CLE CMH 501
#> 215 CLT CMH 757
#> 216 CVG CMH 850
#> 217 CVG CMI 366
#> 218 ATL COS 421
#> 219 BHM COS 1
#> 220 BIL COS 1
#> 221 BNA COS 1
#> 222 BOI COS 1
#> 223 BTV COS 1
#> 224 CVG COS 354
#> 225 CLE CPR 1
#> 226 ATL CRP 516
#> 227 ATL CRW 796
#> 228 CVG CRW 611
#> 229 ATL CSG 953
#> 230 ABE CVG 340
#> 231 ABQ CVG 328
#> 232 ACY CVG 359
#> 233 ALB CVG 318
#> 234 ATL CVG 1992
#> 235 ATW CVG 477
#> 236 AUS CVG 481
#> 237 AVL CVG 514
#> 238 AVP CVG 398
#> 239 AZO CVG 644
#> 240 BDL CVG 503
#> 241 BGM CVG 368
#> 242 BGR CVG 491
#> 243 BHM CVG 758
#> 244 BNA CVG 1084
#> 245 BOS CVG 1306
#> 246 BTR CVG 345
#> 247 BTV CVG 298
#> 248 BUF CVG 433
#> 249 BWI CVG 725
#> 250 CAE CVG 920
#> 251 CAK CVG 801
#> 252 CHA CVG 496
#> 253 CHO CVG 367
#> 254 CHS CVG 588
#> 255 CID CVG 474
#> 256 CLE CVG 722
#> 257 CLT CVG 1127
#> 258 CMH CVG 683
#> 259 CMI CVG 358
#> 260 COS CVG 255
#> 261 CRW CVG 555
#> 262 DAB CVG 191
#> 263 DAY CVG 727
#> 264 ATL DAB 1435
#> 265 CLE DAB 9
#> 266 CVG DAB 195
#> 267 ABQ DAL 920
#> 268 AMA DAL 762
#> 269 AUS DAL 1489
#> 270 ATL DAY 2180
#> 271 BWI DAY 401
#> 272 CLE DAY 450
#> 273 CVG DAY 970