0
0
R Programmingprogramming~5 mins

Filtering rows in R Programming - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aarrange()
Bselect()
Cfilter()
Dmutate()
What does filter(data, age > 25, gender == 'F') do?
ASelects rows where age > 25 AND gender is 'F'
BSelects rows where age > 25 OR gender is 'F'
CSelects rows where age <= 25 AND gender is not 'F'
DSelects all rows
How do you filter rows in base R where score equals 100?
Adata[data$score == 100, ]
Bdata[score = 100, ]
Cfilter(data, score == 100)
Ddata[score == 100]
What will filter(data, age > 20, age < 30) return?
ARows where age is less than 20 or greater than 30
BAll rows
CRows where age is exactly 20 or 30
DRows where age is between 20 and 30 (exclusive)
Which symbol is used for logical AND in dplyr filter conditions?
A&&
B,
C&
D|
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.