Create a airport map with each airport location marked on the map
and colored by the number of flights per day from NYC to each
airport
fpd<- flights%>%
group_by(year, month, day, dest)%>%
summarise(flight_per_day = n(), .groups = "drop")%>%
group_by(dest) %>%
summarise(avg_flights_per_day = mean(flight_per_day))
fpd
## # A tibble: 105 × 2
## dest avg_flights_per_day
## <chr> <dbl>
## 1 ABQ 1
## 2 ACK 1.71
## 3 ALB 1.69
## 4 ANC 1
## 5 ATL 47.2
## 6 AUS 6.68
## 7 AVL 1.11
## 8 BDL 1.76
## 9 BGR 1.44
## 10 BHM 1
## # ℹ 95 more rows
airports %>%
semi_join(fpd, c("faa" = "dest")) %>%
left_join(fpd, by = c("faa" = "dest")) %>%
ggplot(aes(lon, lat)) +
borders("state") +
geom_point(aes(color = avg_flights_per_day) ) +
coord_quickmap()
