Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To create a new data frame that includes flights headed to SFO in February, we first need to filter the flights data frame using the
To create a new data frame that includes flights headed to SFO in February, we first need to filter the flights data frame using the following criteria:
Destination airport is SFO
Flights take place in February
We can use the filter function from the dplyr package to achieve this.
The code would look like this:
r
librarydplyr
sfofebflights filterflights month dest "SFO"
This code creates a new data frame called sfofebflights that includes flights headed to SFO in February.
To determine how many flights meet these criteria, we can use the nrow function to count the number of rows in sfofebflights:
r
nrowsfofebflights
This returns the number of rows ie the number of flights in sfofebflights, which is
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