BaşlayınÜcretsiz Başlayın

Comparing Batman and Star Wars LEGO parts

The table you created in the last exercise includes the part number of each piece, the color id, and the number of each piece in the Star Wars and Batman themes. However, we have more information about each of these parts that we can gain by combining this table with some of the information we have in other tables. Before we compare the themes, let's ensure that we have enough information to make our findings more interpretable. The table from the last exercise has been saved as parts_joined and is preloaded for you.

parts_joined <- batman_parts %>%
  full_join(star_wars_parts, by = c("part_num", "color_id"), suffix = c("_batman", "_star_wars")) %>%
  replace_na(list(n_batman = 0, n_star_wars = 0))

Bu egzersiz

Joining Data with dplyr

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Sort the number of star wars pieces in the parts_joined table in descending order.
  • Inner join the colors table to the parts_joined table.
  • Combine the parts table to the previous join using an inner join; add "_color" and "_part" suffixes to specify whether or not the information came from the colors table or the parts table.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

parts_joined %>%
  # Sort the number of star wars pieces in descending order 
  ___ %>%
  # Join the colors table to the parts_joined table
  ___ %>%
  # Join the parts table to the previous join 
  ___
Kodu Düzenle ve Çalıştır