Create the code makes a table for each of the below questions.

1. join + filter - Which airplanes fly LGA to XNA (1 POINT)

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

lga_to_xna_planes
## # A tibble: 70 × 6
##    tailnum manufacturer         model  year.y seats engine       
##    <chr>   <chr>                <chr>   <int> <int> <chr>        
##  1 N722MQ  <NA>                 <NA>       NA    NA <NA>         
##  2 N719MQ  <NA>                 <NA>       NA    NA <NA>         
##  3 N739MQ  <NA>                 <NA>       NA    NA <NA>         
##  4 N711MQ  GULFSTREAM AEROSPACE G1159B   1976    22 Turbo-jet    
##  5 N723MQ  <NA>                 <NA>       NA    NA <NA>         
##  6 N730MQ  <NA>                 <NA>       NA    NA <NA>         
##  7 N734MQ  <NA>                 <NA>       NA    NA <NA>         
##  8 N725MQ  <NA>                 <NA>       NA    NA <NA>         
##  9 N736MQ  <NA>                 <NA>       NA    NA <NA>         
## 10 N737MQ  CESSNA               172N     1977     4 Reciprocating
## # ℹ 60 more rows

2. join - Add the airline name to the flights table (1 POINT)

flights_with_airline <- flights %>%
  left_join(airlines, by = "carrier") %>%
  select(year, month, day, carrier, name, everything())

flights_with_airline
## # A tibble: 336,776 × 20
##     year month   day carrier name     dep_time sched_dep_time dep_delay arr_time
##    <int> <int> <int> <chr>   <chr>       <int>          <int>     <dbl>    <int>
##  1  2013     1     1 UA      United …      517            515         2      830
##  2  2013     1     1 UA      United …      533            529         4      850
##  3  2013     1     1 AA      America…      542            540         2      923
##  4  2013     1     1 B6      JetBlue…      544            545        -1     1004
##  5  2013     1     1 DL      Delta A…      554            600        -6      812
##  6  2013     1     1 UA      United …      554            558        -4      740
##  7  2013     1     1 B6      JetBlue…      555            600        -5      913
##  8  2013     1     1 EV      Express…      557            600        -3      709
##  9  2013     1     1 B6      JetBlue…      557            600        -3      838
## 10  2013     1     1 AA      America…      558            600        -2      753
## # ℹ 336,766 more rows
## # ℹ 11 more variables: sched_arr_time <int>, arr_delay <dbl>, flight <int>,
## #   tailnum <chr>, origin <chr>, dest <chr>, air_time <dbl>, distance <dbl>,
## #   hour <dbl>, minute <dbl>, time_hour <dttm>

3. join + select + distinct() - Which airports have no commercial flights (1 POINT)

airports_no_flights <- airports %>%
  anti_join(flights, by = c("faa" = "dest")) %>%
  select(faa, name) %>%
  distinct()

airports_no_flights
## # A tibble: 1,357 × 2
##    faa   name                          
##    <chr> <chr>                         
##  1 04G   Lansdowne Airport             
##  2 06A   Moton Field Municipal Airport 
##  3 06C   Schaumburg Regional           
##  4 06N   Randall Airport               
##  5 09J   Jekyll Island Airport         
##  6 0A9   Elizabethton Municipal Airport
##  7 0G6   Williams County Airport       
##  8 0G7   Finger Lakes Regional Airport 
##  9 0P2   Shoestring Aviation Airfield  
## 10 0S9   Jefferson County Intl         
## # ℹ 1,347 more rows

4. EXTRA CREDIT - (2 POINT2) - NO HELP - NO PARTIAL 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

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

airports_high_wind
## # A tibble: 3 × 1
##   name               
##   <chr>              
## 1 Newark Liberty Intl
## 2 John F Kennedy Intl
## 3 La Guardia