forked from AdamWilsonLabEDU/2024-geo511-spatial-data-science-case-studies-geo511_casestudy_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
case_study_4.R
36 lines (25 loc) · 922 Bytes
/
case_study_4.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
# load packages
library(tidyverse)
library(nycflights13)
#examine tables
view(flights)
view(airports)
#arrange by flight distance
flights_by_distance <- flights %>%
arrange(desc(distance))
view(flights_by_distance)
#slice table to isolate farthest airport
flights_to_farthest_airport <- flights_by_distance %>%
slice_max(distance)
view(flights_to_farthest_airport)
#join table with full airport names
flights_and_airports <- flights_to_farthest_airport %>%
left_join(airports, join_by(dest == faa))
view(flights_and_airports)
#select the name of the farthest airport
name_col_of_farthest_airport <- flights_and_airports %>%
select(name)
#convert name to a single character
farthest_airport <- name_col_of_farthest_airport %>%
slice_head()
farthest_airport