Filter data frame rows

We often want to operate only on a specific subset of rows of a data frame. The dplyr filter() function provides a flexible way to extract the rows of interest based on multiple conditions.

  • Use the filter() function to sort out the rows of a data frame that fulfill a specified condition
  • Filter a data frame by multiple conditions
filter(my_data_frame, condition)
filter(my_data_frame, condition_one, condition_two, ...)
View Interactive Version
Filter data frame rows