STAT 542 Homework 6: NOTE: Please carefully read the ALTERATIONS to the book's questions in the Chapter 15 exercises below!!! HINT: Before the Chapter 15 exercises, first enter these lines of code: library(nycflights13) db <- dbConnect_scidb("airlines") flights <- tbl(db, "flights") data(flights) data(airports) library(sqldf) NOTE: Use the sqldf function with your quoted SQL query in the parentheses, as we did in class, to answer these questions involving the 'flights' and 'airports' data tables. Problem 3 in the Chapter 15 Exercises (in Section 15.8 of the book). NOTE: Change the relevant question to "How many flights in the 'flights' data table (don't worry about the word "domestic") flew into DFW on May 4, 2013?" (Note the altered year) Problem 5 in the Chapter 15 Exercises (in Section 15.8 of the book). NOTE: Change the relevant question to "Of all the destinations from JFK airport in 2013, which were the 10 most common?" List the ten most common destinations from JFK in 2013, as well as the number of flights in 2013 for each destination. (Note the altered year and airport) Problem 6 in the Chapter 15 Exercises (in Section 15.8 of the book). NOTE: Change the relevant question to "Using the entire 'flights' data table, which ten destination airports had the highest average arrival delay in 2013?" Please list the FAA code of the airport AND THE FULL AIRPORT NAME as well as the mean arrival delay figure in 2013 for each of the ten destinations that were worst in this respect. (Note the altered year). What is interesting about the airport with the highest mean arrival delay figure in 2013? HINT: You will have to do a JOIN to get the full airport name in the result table. Problem 7 in the Chapter 15 Exercises (in Section 15.8 of the book). NOTE: Change the relevant question to "How many flights in the 'flights' data table (don't worry about the word "domestic") flew into JFK or flew out of JFK in 2013?" (Note the altered year and airport) Problem 8 in the Chapter 15 Exercises (in Section 15.8 of the book). NOTE: Change the relevant question to "Based on the 'flights' data table, list the airline (carrier) AND flight number for all flights *from* JFK *to* LAX on September 26, 2013." (Note the altered year and airport) Problem 2 in the Chapter 16 Exercises (in Section 16.6 of the book). NOTE about format: For this homework, please turn in TWO files into Blackboard: The first file should be a Word document or pdf with the answers to the questions in the form of any output requested (like result tables), and any written answers or interpretations for those problems that call for writing. The second file should be a PLAIN TEXT file (.txt file) with the code that you used to create the results, etc. for the problems. Any lines in this text file that are NOT code should start with # so that they will be treated as comments and not executed.