Answered step by step
Verified Expert Solution
Link Copied!

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
library(dplyr)
sfo_feb_flights <- filter(flights, month ==2, dest == "SFO")
```
This code creates a new data frame called sfo_feb_flights 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 sfo_feb_flights:
```r
nrow(sfo_feb_flights)
```
This returns the number of rows (i.e., the number of flights) in sfo_feb_flights, which is **2286**.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions