Add a Directory HW7

Add a directory HW7 to your repository. This is where you will put the rest of your work for this assignment.

Be sure to commit and push your changes.

1. Cancellations and Destination Location

This problem uses the data in the nycflights13 package.

The airports table contains longitude and latitude for each airport. This can be used to construct a map. A map of the locations of a few airports can be constructed using

library(ggplot2)
library(dplyr)
library(nycflights13)
ap <- filter(airports, faa %in% c("ATL", "DEN", "JFK", "MSP", "ORD", "SFO"))
ggplot(ap, aes(x = lon, y = lat)) +
borders("state") + geom_point(size = 3) + coord_map()
• For the first three months of 2013, compute the number of flights, the average arrival delay, and the proportion of canceled flights to each of the destinations.

• Focus on the top 50 destinations in terms of the number of flights from NYC during the first three months of 2013.

• Create a map with a point at each of these destinations, and encode the proportion of canceled flights in the point’s size. Comment on what you see.

• In addition to the location and proportion of canceled flights, whether the average arrival delay is more or less than 20 minutes could be encoded using color or shape. Try both approaches, comment on what you see and on the advantages and disadvantages of each approach.

2. Wind Speed, Time of Day, and Departure Delays

Examine the relationship between departure delays, wind speed, and hour of departure for the nycflights13 data:

• Compute average delays for each hour and wind_speed combination, along with the number of flights at each level combination.

• Examine how the relationship between average departure delay and hour of departure varies with wind speed.

• How do your conclusions relate to your observations on the relation between departure delays and wind speed found in the previous assignment?

Write up your work in an Rmarkdown document called hw7.Rmd in your HW7 folder, and commit it to your local repository. You can commit the hw7.html file as well but you do not need to.

Make Sure Your Work Is Reproducible

One of the goals of using git, GitHub, and Rmarkdown is for you to practice creating a framework that you can hand to someone else to reproduce your analysis. This means, among other things, that

• you should not make use of files from your computer outside of your repository;

• you should not rely on being able to change the working directory to your home directory;

• you should assume that your code might be run an a case-sensitive file system.

If you are working on Windows or a Mac a good test is to go to our Linux systems, check out your repository, and check that your hw7.Rmd file can be rendered successfully to produce hw7.html. You can do this using the RStudio menus or from the R command line with

rmarkdown::render("hw7.Rmd")

Make sure your working directory is HW7 for this.

You can also run this command in a shell in your HW7 directory:

Rscript -e 'rmarkdown::render("hw7.Rmd")'

Make sure you use the right combination of single and double quotes.