library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.8
## ✓ tidyr 1.2.0 ✓ stringr 1.4.0
## ✓ readr 2.1.2 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
abalone <- read_csv("abalone.csv")
## Rows: 300 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (9): row.names, Length, Diameter, Height, Whole.wt, Shucked.wt, Viscera....
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
my_vec <- c(1, 3, 4)
my_vec
## [1] 1 3 4
length(my_vec)
## [1] 3
my_vec[3]
## [1] 4
my_vec[c(1,2)]
## [1] 1 3
Recall a data frame is a list under the hood, with entries that are the columns.
abalone
## # A tibble: 300 × 9
## row.names Length Diameter Height Whole.wt Shucked.wt Viscera.wt Shell.wt
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1942 0.625 0.47 0.145 0.984 0.475 0.2 0.265
## 2 503 0.62 0.47 0.225 1.12 0.378 0.214 0.36
## 3 312 0.56 0.44 0.14 0.971 0.443 0.204 0.265
## 4 655 0.37 0.28 0.11 0.230 0.0945 0.0465 0.075
## 5 1004 0.595 0.455 0.15 1.04 0.518 0.220 0.27
## 6 2522 0.54 0.42 0.12 0.812 0.392 0.146 0.224
## 7 1558 0.425 0.325 0.11 0.317 0.135 0.048 0.09
## 8 2622 0.695 0.525 0.175 1.74 0.696 0.389 0.505
## 9 3122 0.55 0.425 0.14 0.952 0.490 0.194 0.218
## 10 607 0.345 0.27 0.09 0.195 0.078 0.0455 0.059
## # … with 290 more rows, and 1 more variable: Rings <dbl>
length(abalone)
## [1] 9
abalone[[1]]
## [1] 1942 503 312 655 1004 2522 1558 2622 3122 607 205 3065 30 2652 1474
## [16] 3043 2108 2850 343 1850 1593 1555 660 617 685 3123 2904 2762 2535 2270
## [31] 649 521 1042 1611 426 2393 1184 963 1872 717 1573 1359 196 1258 891
## [46] 1121 2490 844 2595 1916 2815 135 21 1983 1956 2593 1438 842 322 1200
## [61] 2180 2632 2911 1166 1204 1312 801 1362 1731 812 2233 2418 1387 455 2168
## [76] 1485 3042 2171 122 2906 1378 2085 754 3110 1207 350 1063 2199 2373 2504
## [91] 2597 2726 2095 2112 52 2173 987 2339 526 653 2128 663 762 1001 2858
## [106] 715 2889 1856 1431 2881 2297 1727 2246 810 2094 352 2728 2463 2975 576
## [121] 3029 536 2608 918 2239 2617 2494 1903 3062 1578 454 1299 2861 433 2408
## [136] 674 1669 193 1252 945 1404 1699 1449 1827 973 1889 367 1142 2685 2639
## [151] 1050 400 1518 2566 1497 2973 28 2869 1921 1066 432 1137 3027 1788 2117
## [166] 423 1012 1661 862 2078 759 25 1127 1178 1756 1554 1978 1301 445 959
## [181] 2875 1549 2539 413 1837 108 1335 241 873 2301 1919 1747 670 1071 860
## [196] 1757 1817 1524 2213 2147 2043 2583 1337 2241 2864 372 251 2695 1533 867
## [211] 1196 1302 18 2319 2498 1692 2374 281 2665 431 2810 1496 1219 2081 2447
## [226] 2540 277 1386 1380 2259 2589 60 1310 2386 1297 577 2456 995 198 3082
## [241] 2521 2114 2051 2367 941 467 1250 417 3006 2205 447 3086 805 1246 1659
## [256] 2698 1742 1346 737 2314 1735 389 2612 2915 1232 2190 573 2207 519 1397
## [271] 51 2248 1537 2523 516 2345 133 36 2725 1572 336 1577 905 1191 316
## [286] 1529 1910 2417 777 2944 282 769 1429 1724 2670 1873 186 136 2404 1408
abalone[1]
## # A tibble: 300 × 1
## row.names
## <dbl>
## 1 1942
## 2 503
## 3 312
## 4 655
## 5 1004
## 6 2522
## 7 1558
## 8 2622
## 9 3122
## 10 607
## # … with 290 more rows
abalone[[1]][3]
## [1] 312
abalone$Length
## [1] 0.625 0.620 0.560 0.370 0.595 0.540 0.425 0.695 0.550 0.345 0.420 0.635
## [13] 0.575 0.510 0.550 0.575 0.675 0.630 0.620 0.485 0.525 0.410 0.585 0.470
## [25] 0.510 0.560 0.575 0.550 0.640 0.570 0.460 0.210 0.675 0.545 0.580 0.330
## [37] 0.665 0.505 0.530 0.290 0.480 0.605 0.500 0.430 0.695 0.545 0.490 0.505
## [49] 0.595 0.600 0.275 0.265 0.355 0.720 0.645 0.590 0.400 0.495 0.190 0.720
## [61] 0.595 0.375 0.580 0.615 0.730 0.550 0.460 0.605 0.665 0.490 0.560 0.310
## [73] 0.630 0.645 0.370 0.590 0.575 0.285 0.385 0.575 0.620 0.690 0.580 0.380
## [85] 0.750 0.610 0.280 0.270 0.405 0.300 0.600 0.395 0.405 0.455 0.400 0.215
## [97] 0.570 0.655 0.175 0.470 0.400 0.415 0.550 0.595 0.665 0.350 0.510 0.500
## [109] 0.230 0.475 0.535 0.660 0.460 0.520 0.505 0.585 0.405 0.440 0.745 0.610
## [121] 0.515 0.465 0.625 0.410 0.460 0.650 0.420 0.575 0.630 0.490 0.565 0.530
## [133] 0.720 0.565 0.625 0.490 0.610 0.580 0.405 0.465 0.650 0.630 0.440 0.310
## [145] 0.525 0.565 0.580 0.575 0.625 0.460 0.715 0.585 0.665 0.450 0.620 0.720
## [157] 0.590 0.335 0.605 0.315 0.600 0.575 0.495 0.545 0.310 0.490 0.625 0.600
## [169] 0.595 0.610 0.570 0.615 0.560 0.645 0.720 0.390 0.700 0.530 0.410 0.500
## [181] 0.425 0.385 0.660 0.580 0.415 0.500 0.575 0.565 0.620 0.480 0.600 0.700
## [193] 0.450 0.375 0.595 0.725 0.675 0.690 0.595 0.465 0.385 0.530 0.575 0.415
## [205] 0.740 0.660 0.330 0.650 0.285 0.605 0.705 0.535 0.440 0.505 0.505 0.625
## [217] 0.500 0.535 0.570 0.570 0.710 0.620 0.315 0.645 0.550 0.675 0.660 0.630
## [229] 0.620 0.430 0.570 0.505 0.545 0.450 0.525 0.560 0.235 0.580 0.640 0.730
## [241] 0.525 0.385 0.450 0.695 0.460 0.670 0.395 0.630 0.680 0.420 0.565 0.255
## [253] 0.515 0.385 0.600 0.660 0.680 0.585 0.520 0.595 0.670 0.490 0.630 0.590
## [265] 0.365 0.490 0.590 0.290 0.325 0.645 0.520 0.470 0.335 0.545 0.270 0.670
## [277] 0.325 0.465 0.385 0.475 0.620 0.490 0.315 0.690 0.450 0.725 0.580 0.425
## [289] 0.505 0.630 0.360 0.550 0.815 0.655 0.590 0.530 0.620 0.425 0.290 0.655
abalone[["Length"]]
## [1] 0.625 0.620 0.560 0.370 0.595 0.540 0.425 0.695 0.550 0.345 0.420 0.635
## [13] 0.575 0.510 0.550 0.575 0.675 0.630 0.620 0.485 0.525 0.410 0.585 0.470
## [25] 0.510 0.560 0.575 0.550 0.640 0.570 0.460 0.210 0.675 0.545 0.580 0.330
## [37] 0.665 0.505 0.530 0.290 0.480 0.605 0.500 0.430 0.695 0.545 0.490 0.505
## [49] 0.595 0.600 0.275 0.265 0.355 0.720 0.645 0.590 0.400 0.495 0.190 0.720
## [61] 0.595 0.375 0.580 0.615 0.730 0.550 0.460 0.605 0.665 0.490 0.560 0.310
## [73] 0.630 0.645 0.370 0.590 0.575 0.285 0.385 0.575 0.620 0.690 0.580 0.380
## [85] 0.750 0.610 0.280 0.270 0.405 0.300 0.600 0.395 0.405 0.455 0.400 0.215
## [97] 0.570 0.655 0.175 0.470 0.400 0.415 0.550 0.595 0.665 0.350 0.510 0.500
## [109] 0.230 0.475 0.535 0.660 0.460 0.520 0.505 0.585 0.405 0.440 0.745 0.610
## [121] 0.515 0.465 0.625 0.410 0.460 0.650 0.420 0.575 0.630 0.490 0.565 0.530
## [133] 0.720 0.565 0.625 0.490 0.610 0.580 0.405 0.465 0.650 0.630 0.440 0.310
## [145] 0.525 0.565 0.580 0.575 0.625 0.460 0.715 0.585 0.665 0.450 0.620 0.720
## [157] 0.590 0.335 0.605 0.315 0.600 0.575 0.495 0.545 0.310 0.490 0.625 0.600
## [169] 0.595 0.610 0.570 0.615 0.560 0.645 0.720 0.390 0.700 0.530 0.410 0.500
## [181] 0.425 0.385 0.660 0.580 0.415 0.500 0.575 0.565 0.620 0.480 0.600 0.700
## [193] 0.450 0.375 0.595 0.725 0.675 0.690 0.595 0.465 0.385 0.530 0.575 0.415
## [205] 0.740 0.660 0.330 0.650 0.285 0.605 0.705 0.535 0.440 0.505 0.505 0.625
## [217] 0.500 0.535 0.570 0.570 0.710 0.620 0.315 0.645 0.550 0.675 0.660 0.630
## [229] 0.620 0.430 0.570 0.505 0.545 0.450 0.525 0.560 0.235 0.580 0.640 0.730
## [241] 0.525 0.385 0.450 0.695 0.460 0.670 0.395 0.630 0.680 0.420 0.565 0.255
## [253] 0.515 0.385 0.600 0.660 0.680 0.585 0.520 0.595 0.670 0.490 0.630 0.590
## [265] 0.365 0.490 0.590 0.290 0.325 0.645 0.520 0.470 0.335 0.545 0.270 0.670
## [277] 0.325 0.465 0.385 0.475 0.620 0.490 0.315 0.690 0.450 0.725 0.580 0.425
## [289] 0.505 0.630 0.360 0.550 0.815 0.655 0.590 0.530 0.620 0.425 0.290 0.655
This is exactly equivalent to the $ notation.
abalone[c("Length", "Height")]
## # A tibble: 300 × 2
## Length Height
## <dbl> <dbl>
## 1 0.625 0.145
## 2 0.62 0.225
## 3 0.56 0.14
## 4 0.37 0.11
## 5 0.595 0.15
## 6 0.54 0.12
## 7 0.425 0.11
## 8 0.695 0.175
## 9 0.55 0.14
## 10 0.345 0.09
## # … with 290 more rows
a %>% b()
means: take value of a
(any
variable, e.g. a tibble/data frame), and call the function
b()
, using a
as the first argument. Most
commonly, a
is a tibble, b
is a dplyr
verb.
?dplyr::select
select()
can be used to index into tibbles - in
particular to extract columns. Above we selected the length and height
using abalone[c("Length", "Height")]
. We can do the same
with select()
:
select(abalone, Length, Height)
## # A tibble: 300 × 2
## Length Height
## <dbl> <dbl>
## 1 0.625 0.145
## 2 0.62 0.225
## 3 0.56 0.14
## 4 0.37 0.11
## 5 0.595 0.15
## 6 0.54 0.12
## 7 0.425 0.11
## 8 0.695 0.175
## 9 0.55 0.14
## 10 0.345 0.09
## # … with 290 more rows
abalone %>%
select(Length, Height)
## # A tibble: 300 × 2
## Length Height
## <dbl> <dbl>
## 1 0.625 0.145
## 2 0.62 0.225
## 3 0.56 0.14
## 4 0.37 0.11
## 5 0.595 0.15
## 6 0.54 0.12
## 7 0.425 0.11
## 8 0.695 0.175
## 9 0.55 0.14
## 10 0.345 0.09
## # … with 290 more rows
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
abalone %>%
dplyr::filter(Length <= 0.5)
## # A tibble: 113 × 9
## row.names Length Diameter Height Whole.wt Shucked.wt Viscera.wt Shell.wt
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 655 0.37 0.28 0.11 0.230 0.0945 0.0465 0.075
## 2 1558 0.425 0.325 0.11 0.317 0.135 0.048 0.09
## 3 607 0.345 0.27 0.09 0.195 0.078 0.0455 0.059
## 4 205 0.42 0.335 0.115 0.369 0.171 0.071 0.12
## 5 1850 0.485 0.385 0.13 0.568 0.250 0.178 0.154
## 6 1555 0.41 0.3 0.09 0.304 0.129 0.071 0.0955
## 7 617 0.47 0.355 0.14 0.433 0.152 0.095 0.152
## 8 649 0.46 0.35 0.12 0.488 0.193 0.105 0.155
## 9 521 0.21 0.15 0.05 0.0385 0.0155 0.0085 0.01
## 10 2393 0.33 0.25 0.09 0.197 0.085 0.041 0.0605
## # … with 103 more rows, and 1 more variable: Rings <dbl>
dplyr::filter(abalone, Length <= 0.5)
## # A tibble: 113 × 9
## row.names Length Diameter Height Whole.wt Shucked.wt Viscera.wt Shell.wt
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 655 0.37 0.28 0.11 0.230 0.0945 0.0465 0.075
## 2 1558 0.425 0.325 0.11 0.317 0.135 0.048 0.09
## 3 607 0.345 0.27 0.09 0.195 0.078 0.0455 0.059
## 4 205 0.42 0.335 0.115 0.369 0.171 0.071 0.12
## 5 1850 0.485 0.385 0.13 0.568 0.250 0.178 0.154
## 6 1555 0.41 0.3 0.09 0.304 0.129 0.071 0.0955
## 7 617 0.47 0.355 0.14 0.433 0.152 0.095 0.152
## 8 649 0.46 0.35 0.12 0.488 0.193 0.105 0.155
## 9 521 0.21 0.15 0.05 0.0385 0.0155 0.0085 0.01
## 10 2393 0.33 0.25 0.09 0.197 0.085 0.041 0.0605
## # … with 103 more rows, and 1 more variable: Rings <dbl>
abalone %>%
slice(c(4,6))
## # A tibble: 2 × 9
## row.names Length Diameter Height Whole.wt Shucked.wt Viscera.wt Shell.wt Rings
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 655 0.37 0.28 0.11 0.230 0.0945 0.0465 0.075 10
## 2 2522 0.54 0.42 0.12 0.812 0.392 0.146 0.224 9
abalone %>%
select(c(2,7))
## # A tibble: 300 × 2
## Length Viscera.wt
## <dbl> <dbl>
## 1 0.625 0.2
## 2 0.62 0.214
## 3 0.56 0.204
## 4 0.37 0.0465
## 5 0.595 0.220
## 6 0.54 0.146
## 7 0.425 0.048
## 8 0.695 0.389
## 9 0.55 0.194
## 10 0.345 0.0455
## # … with 290 more rows
abalone[c(4,6),]
## # A tibble: 2 × 9
## row.names Length Diameter Height Whole.wt Shucked.wt Viscera.wt Shell.wt Rings
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 655 0.37 0.28 0.11 0.230 0.0945 0.0465 0.075 10
## 2 2522 0.54 0.42 0.12 0.812 0.392 0.146 0.224 9
abalone[,c(2,7)]
## # A tibble: 300 × 2
## Length Viscera.wt
## <dbl> <dbl>
## 1 0.625 0.2
## 2 0.62 0.214
## 3 0.56 0.204
## 4 0.37 0.0465
## 5 0.595 0.220
## 6 0.54 0.146
## 7 0.425 0.048
## 8 0.695 0.389
## 9 0.55 0.194
## 10 0.345 0.0455
## # … with 290 more rows
library(nycflights13)
airports
## # A tibble: 1,458 × 8
## faa name lat lon alt tz dst tzone
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr>
## 1 04G Lansdowne Airport 41.1 -80.6 1044 -5 A America/…
## 2 06A Moton Field Municipal Airport 32.5 -85.7 264 -6 A America/…
## 3 06C Schaumburg Regional 42.0 -88.1 801 -6 A America/…
## 4 06N Randall Airport 41.4 -74.4 523 -5 A America/…
## 5 09J Jekyll Island Airport 31.1 -81.4 11 -5 A America/…
## 6 0A9 Elizabethton Municipal Airport 36.4 -82.2 1593 -5 A America/…
## 7 0G6 Williams County Airport 41.5 -84.5 730 -5 A America/…
## 8 0G7 Finger Lakes Regional Airport 42.9 -76.8 492 -5 A America/…
## 9 0P2 Shoestring Aviation Airfield 39.8 -76.6 1000 -5 U America/…
## 10 0S9 Jefferson County Intl 48.1 -123. 108 -8 A America/…
## # … with 1,448 more rows
airports_new <- airports %>%
group_by(tzone) %>%
summarise(mean_lon=mean(lon),
mean_lat=mean(lat),
n_obs=n())
airports_new
## # A tibble: 10 × 4
## tzone mean_lon mean_lat n_obs
## <chr> <dbl> <dbl> <int>
## 1 America/Anchorage -153. 61.3 239
## 2 America/Chicago -92.9 37.2 342
## 3 America/Denver -108. 40.4 119
## 4 America/Los_Angeles -120. 40.0 176
## 5 America/New_York -79.4 37.6 519
## 6 America/Phoenix -112. 33.8 38
## 7 America/Vancouver -127. 55.0 2
## 8 Asia/Chongqing 115. 32.9 2
## 9 Pacific/Honolulu -157. 20.8 18
## 10 <NA> -58.7 54.7 3
airports %>%
summarise(mean_lon=mean(lon),
mean_lat=mean(lat))
## # A tibble: 1 × 2
## mean_lon mean_lat
## <dbl> <dbl>
## 1 -103. 41.6
flights
## # A tibble: 336,776 × 19
## year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time
## <int> <int> <int> <int> <int> <dbl> <int> <int>
## 1 2013 1 1 517 515 2 830 819
## 2 2013 1 1 533 529 4 850 830
## 3 2013 1 1 542 540 2 923 850
## 4 2013 1 1 544 545 -1 1004 1022
## 5 2013 1 1 554 600 -6 812 837
## 6 2013 1 1 554 558 -4 740 728
## 7 2013 1 1 555 600 -5 913 854
## 8 2013 1 1 557 600 -3 709 723
## 9 2013 1 1 557 600 -3 838 846
## 10 2013 1 1 558 600 -2 753 745
## # … with 336,766 more rows, and 11 more variables: arr_delay <dbl>,
## # carrier <chr>, flight <int>, tailnum <chr>, origin <chr>, dest <chr>,
## # air_time <dbl>, distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>
airports
## # A tibble: 1,458 × 8
## faa name lat lon alt tz dst tzone
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr>
## 1 04G Lansdowne Airport 41.1 -80.6 1044 -5 A America/…
## 2 06A Moton Field Municipal Airport 32.5 -85.7 264 -6 A America/…
## 3 06C Schaumburg Regional 42.0 -88.1 801 -6 A America/…
## 4 06N Randall Airport 41.4 -74.4 523 -5 A America/…
## 5 09J Jekyll Island Airport 31.1 -81.4 11 -5 A America/…
## 6 0A9 Elizabethton Municipal Airport 36.4 -82.2 1593 -5 A America/…
## 7 0G6 Williams County Airport 41.5 -84.5 730 -5 A America/…
## 8 0G7 Finger Lakes Regional Airport 42.9 -76.8 492 -5 A America/…
## 9 0P2 Shoestring Aviation Airfield 39.8 -76.6 1000 -5 U America/…
## 10 0S9 Jefferson County Intl 48.1 -123. 108 -8 A America/…
## # … with 1,448 more rows
left_join(airports, flights, by=c("faa"="origin"))
## # A tibble: 338,231 × 26
## faa name lat lon alt tz dst tzone year month day dep_time
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <int> <int> <int> <int>
## 1 04G Lansdo… 41.1 -80.6 1044 -5 A Amer… NA NA NA NA
## 2 06A Moton … 32.5 -85.7 264 -6 A Amer… NA NA NA NA
## 3 06C Schaum… 42.0 -88.1 801 -6 A Amer… NA NA NA NA
## 4 06N Randal… 41.4 -74.4 523 -5 A Amer… NA NA NA NA
## 5 09J Jekyll… 31.1 -81.4 11 -5 A Amer… NA NA NA NA
## 6 0A9 Elizab… 36.4 -82.2 1593 -5 A Amer… NA NA NA NA
## 7 0G6 Willia… 41.5 -84.5 730 -5 A Amer… NA NA NA NA
## 8 0G7 Finger… 42.9 -76.8 492 -5 A Amer… NA NA NA NA
## 9 0P2 Shoest… 39.8 -76.6 1000 -5 U Amer… NA NA NA NA
## 10 0S9 Jeffer… 48.1 -123. 108 -8 A Amer… NA NA NA NA
## # … with 338,221 more rows, and 14 more variables: sched_dep_time <int>,
## # dep_delay <dbl>, arr_time <int>, sched_arr_time <int>, arr_delay <dbl>,
## # carrier <chr>, flight <int>, tailnum <chr>, dest <chr>, air_time <dbl>,
## # distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>
inner_join(airports, flights, by=c("faa"="origin"))
## # A tibble: 336,776 × 26
## faa name lat lon alt tz dst tzone year month day dep_time
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <int> <int> <int> <int>
## 1 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 517
## 2 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 554
## 3 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 555
## 4 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 558
## 5 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 559
## 6 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 601
## 7 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 606
## 8 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 607
## 9 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 608
## 10 EWR Newark … 40.7 -74.2 18 -5 A Amer… 2013 1 1 615
## # … with 336,766 more rows, and 14 more variables: sched_dep_time <int>,
## # dep_delay <dbl>, arr_time <int>, sched_arr_time <int>, arr_delay <dbl>,
## # carrier <chr>, flight <int>, tailnum <chr>, dest <chr>, air_time <dbl>,
## # distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>