Recall & Review
beginner
What is the purpose of filtering rows in R?
Filtering rows means selecting only the rows from a data frame that meet certain conditions. It helps focus on specific data you want to analyze.
Click to reveal answer
beginner
Which function from the dplyr package is commonly used to filter rows?
The
filter() function is used to select rows that satisfy given conditions.Click to reveal answer
beginner
How do you filter rows where the column
age is greater than 30 using dplyr?Use
filter(data, age > 30) to keep only rows where the age is more than 30.Click to reveal answer
intermediate
What happens if you use multiple conditions inside
filter() separated by commas?Multiple conditions separated by commas act like AND. All conditions must be true for a row to be kept.
Click to reveal answer
intermediate
How can you filter rows using base R without dplyr?
Use square brackets with a logical condition, like
data[data$age > 30, ] to select rows where age is greater than 30.Click to reveal answer
Which function is used in dplyr to filter rows?
✗ Incorrect
The
filter() function is designed to select rows based on conditions.What does
filter(data, age > 25, gender == 'F') do?✗ Incorrect
Multiple conditions separated by commas mean AND, so both must be true.
How do you filter rows in base R where score equals 100?
✗ Incorrect
In base R, use
data[data$score == 100, ] to filter rows.What will
filter(data, age > 20, age < 30) return?✗ Incorrect
Both conditions must be true, so age must be greater than 20 and less than 30.
Which symbol is used for logical AND in dplyr filter conditions?
✗ Incorrect
In
filter(), multiple conditions separated by commas act as AND.Explain how to filter rows in R using both dplyr and base R methods.
Think about how you select rows with conditions in both styles.
You got /4 concepts.
Describe how multiple conditions work inside the dplyr filter() function.
How do commas affect the filtering?
You got /3 concepts.