Get startedGet started for free

The %in% operator

What if you wanted to select for multiple values? You can use the %in% operator. Here we put the values into a vector with the c() function, which concatentates the values together into a form that R can manipulate. Note that these values have to be exact.

biopicsUSUK <- biopics %>% filter(country %in% c("US", "UK"))

This exercise is part of the course

RBootcamp

View Course

Exercise instructions

  • Pick out the Musician, Artist and Singer movies from type_of_subject.
  • Assign the output to biopicsArt.

Hands-on interactive exercise

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

biopicsArt <- biopics %>%
Edit and Run Code