MulaiMulai sekarang secara gratis

Full joining Batman and Star Wars LEGO parts

Now that you've got separate tables for the pieces in the batman and star_wars themes, you'll want to be able to combine them to see any similarities or differences between the two themes. The aggregating from the last exercise has been saved as batman_parts and star_wars_parts, and is preloaded for you.

batman_parts <- batman %>%
  count(part_num, color_id, wt = quantity)

star_wars_parts <- star_wars %>%
  count(part_num, color_id, wt = quantity)

Latihan ini adalah bagian dari kursus

Joining Data with dplyr

Lihat Kursus

Petunjuk latihan

  • Combine the star_wars_parts table with the batman_parts table; use the suffix argument to include the "_batman" and "_star_wars" suffixes.
  • Replace all the NA values in the n_batman and n_star_wars columns with 0s.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

batman_parts %>%
  # Combine the star_wars_parts table 
  ___ %>%
  # Replace NAs with 0s in the n_batman and n_star_wars columns 
  ___
Edit dan Jalankan Kode