Get startedGet started for free

Filtering with %in%

%in% allows selecting rows that exactly matches one or more values, for example:

c("a", "b", "c", "d") %in% c("d", "a")
[1]  TRUE FALSE FALSE  TRUE

This exercise is part of the course

Data Manipulation with data.table in R

View Course

Exercise instructions

Filter all rows where trip_id is equal to 588841, 139560, or 139562.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Filter all rows where trip_id is 588841, 139560, or 139562
filter_trip_ids <- batrips[___]
filter_trip_ids
Edit and Run Code