CommencerCommencer gratuitement

Joining themes to their children

Tables can be joined to themselves!

In the themes table, which is available for you to inspect in the console, you'll notice there is both an id column and a parent_id column. Keeping that in mind, you can join the themes table to itself to determine the parent-child relationships that exist for different themes.

In the videos, you saw themes joined to their own parents. In this exercise, you'll try a similar approach of joining themes to their own children, which is similar but reversed. Let's try this out to discover what children the theme "Harry Potter" has.

Cet exercice fait partie du cours

Joining Data with dplyr

Afficher le cours

Instructions

  • Inner join themes to their own children, resulting in the suffixes "_parent" and "_child", respectively.
  • Filter this table to find the children of the "Harry Potter" theme.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

themes %>% 
  # Inner join the themes table
  ___ %>%
  # Filter for the "Harry Potter" parent name 
  ___
Modifier et exécuter le code