Question 1: join + filter - Which airplanes fly LGA to XNA

library(nycflights13)
library(tidyverse)

q1 <- flights %>%
  filter(origin == "LGA", dest == "XNA") %>%
  left_join(planes, by = "tailnum") %>%
  select(tailnum, year.y, type, manufacturer, model, engines, seats) %>%
  distinct()

Question 2: join - Add the airline name to the flights table

q2 <- flights %>%
  left_join(airlines, by = "carrier") %>%
  rename(airline_name = name)

Question 3: join + select + distinct() - Which airports have no commercial flights

q3 <- flights %>%
  select(origin, dest) %>%
  pivot_longer(cols = everything(), names_to = "role", values_to = "faa") %>%
  distinct(faa)

Question 4: Extra Credit * Create a table with the names of the airports with the most * winds (wind_speed > 30). The table must contain only the airport * name (airports$name) and no duplicate rows

q4 <- weather %>%
  filter(wind_speed > 30) %>%
  left_join(airports, by = c("origin" = "faa")) %>%
  select(name) %>%
  distinct() %>%
  rename(airport_name = name)