Use the dataset NYCFlights13 to create a treemap that explores Arrival Time and Departure Delays

#install.packages("nycflights13")
library(nycflights13)
library(RColorBrewer)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(treemap)
data(flights)
flights_nona <- flights %>%
  filter(!is.na(distance) & !is.na(arr_delay)) # remove na's for distance and arr_delay
treemap(flights_nona, index="dest", vSize="arr_time", 
        vColor="dep_delay", type="manual",    
        # note: type = "manual" changes to red yellow blue
        palette="RdYlBu",
        title="NYC Arrival Time and Departure Delays")

I created a NYC Arrival Time and Departure Delays Treemap using the flights dataset. I choose Destination as the categorical variable, Arrival time and Departure delay time as quantitative variables. Since the value has to be greater than 0 to create a treemap, I had to make a whole new data frame. I did !is.na to filter the negative numbers in the dataset flights to generate flights_nona to use for the treemap.The size and the color are correlated with the tree structure. The size of rectangles are the quantify of arrival time. The color reflects the departure delay time. The more blue it is, the longer the delay time is. Apparently, Atlanta International Airport and Chicago International airports are the two that have the most delays.