Aan de slagGa gratis aan de slag

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)

Deze oefening maakt deel uit van de cursus

Joining Data with dplyr

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 %>%
  ___
Code bewerken en uitvoeren