Get startedGet started for free

Something within one set but not another

In the videos, you learned how to filter using the semi- and anti join verbs to answer questions you have about your data. Let's focus on the batwing dataset, and use our skills to determine which parts are in both the batwing and batmobile sets, and which sets are in one, but not the other. While answering these questions, we'll also be determining whether or not the parts we're looking at in both sets also have the same color in common.

The batmobile and batwing datasets have been preloaded for you.

batmobile <- inventory_parts_joined %>%
  filter(set_num == "7784-1") %>%
  select(-set_num)

batwing <- inventory_parts_joined %>%
  filter(set_num == "70916-1") %>%
  select(-set_num)

This exercise is part of the course

Joining Data with dplyr

View Course

Exercise instructions

  • Filter the batwing set for parts that are also in the batmobile, whether or not they have the same color.
  • Filter the batwing set for parts that aren't also in the batmobile, whether or not they have the same color.

Hands-on interactive exercise

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

# Filter the batwing set for parts that are also in the batmobile set
batwing %>%
  ___

# Filter the batwing set for parts that aren't in the batmobile set
batwing %>%
  ___
Edit and Run Code