MulaiMulai sekarang secara gratis

Aggregating each theme

Previously, you combined tables to compare themes. Before doing this comparison, you'll want to aggregate the data to learn more about the pieces that are a part of each theme, as well as the colors of those pieces.

The table you created previously has been preloaded for you as inventory_sets_themes. It was filtered for each theme, and the objects have been saved as batman and star_wars.

inventory_sets_themes <- inventory_parts_joined %>%
  inner_join(sets, by = "set_num") %>%
  inner_join(themes, by = c("theme_id" = "id"), suffix = c("_set", "_theme"))

batman <- inventory_sets_themes %>%
  filter(name_theme == "Batman")

star_wars <- inventory_sets_themes %>%
  filter(name_theme == "Star Wars")

Latihan ini adalah bagian dari kursus

Joining Data with dplyr

Lihat Kursus

Petunjuk latihan

  • Count the part number and color id for the parts in Batman and Star Wars, weighted by quantity.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Count the part number and color id, weight by quantity
batman %>%
  ___

star_wars %>%
  ___
Edit dan Jalankan Kode