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
Exercise instructions
- Pick out the
Musician
,Artist
andSinger
movies fromtype_of_subject
. - Assign the output to
biopicsArt
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
biopicsArt <- biopics %>%