TP3 Introduction A R 2024-2025 (Homework) EN
TP3 Introduction A R 2024-2025 (Homework) EN
All your work will be sent through a TP3.R script file. Make sure you display the results
of all your commands.
PART 1
1. Display the content of the data frame flights of the nycflights13 pa-
ckage.
2. What is that data frame about ?
3. Name the five (05) dplyr key functions.
4. Display all flights that departed on February 13th.
5. Display all flights that departed in December or January.
6. Display flights that weren’t delayed (on arrival or departure) by more than
an hour.
7. Rewrite the previous script using De Morgan’s law.
8. How many flights have a missing dep_time ? What other variables are mis-
sing ? What might these rows represent ?
9. What does the following script do ?
arrange(flights, desc(arr_delay))
10. What does the following script do ?
transmute(flights, dep_time, hour = dep_time %/% 100,
minute = dep_time %% 100)
PART 2
1. What time of day should you fly if you want to avoid delays as much as
possible ?
2. For each destination, compute the total minutes of delay.
3. For each flight, compute the proportion of the total delay for its destina-
tion.
4. Find all destinations that are flown by at least two carriers. Use that infor-
mation to rank the carriers.
5. Which plane (tailnum) has the worst on-time record ?