Question
Rstudio library(tidyverse) library(nycflights13) flights #### 1. What is the average and standard deviation of arrival delay for each carrier? Among three major US airlines (UA,
Rstudio
library(tidyverse) library(nycflights13) flights
#### 1. What is the average and standard deviation of arrival delay for each carrier? Among three major US airlines (UA, AA, DL), which one is the best and which one is the worst in terms of delay? ```{r} flight1<- flights %>% group_by(flights, dest) %>% # set group structure for each carrier summarise(avg.arr.delay= , sd.arr.delay= ) # calculate average and standard deviation
flight1 %>% filter(flights, carrier%in%c("UA","AA","DL")) %>% # filter three airlines arrange(flights, dep_delay, desc(day)) # sort ```
#### 2. For each of the three major US airlines, how many flights have been canceled? Draw a bar chart to show your result, and label each bar with the numbers. ```{r} flights %>% filter( flights, carrier%in%c("UA","AA","DL") ) %>% # filter three airlines, and canceled flights group_by(flights$) %>% # set group structure for each carrier summarise(count= ) %>% # what is the function to get count ggplot(aes(x= , y= )) + # specify x and y on your bar chart geom_bar(stat="identity", fill="blue") + geom_text(stat="identity", aes(label=count), vjust=-0.5)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started