शुरू करेंमुफ़्त में शुरू करें

सेट्स को मिलाना

पिछले अभ्यास में आपने जो डेटा एग्रीगेट किया था, वह आपके लिए batman_colors और star_wars_colors के रूप में प्रीलोड कर दिया गया है। डेटा को विज़ुअलाइज़ करने से पहले, आप इन टेबल्स को मिलाना चाहेंगे ताकि थीम्स के रंगों की सीधी तुलना की जा सके।

batman_colors <- inventory_parts_themes %>%
  filter(name_theme == "Batman") %>%
  group_by(color_id) %>%
  summarize(total = sum(quantity)) %>%
  mutate(fraction = total / sum(total))
star_wars_colors <- inventory_parts_themes %>%
  filter(name_theme == "Star Wars") %>%
  group_by(color_id) %>%
  summarize(total = sum(quantity)) %>%
  mutate(fraction = total / sum(total))

यह अभ्यास पाठ्यक्रम का हिस्सा है

dplyr के साथ डेटा जॉइन करना

पाठ्यक्रम देखें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

batman_colors %>%
  # Join the Batman and Star Wars colors
  ___(star_wars_colors, by = "color_id", suffix = c("_batman", "_star_wars")) %>%
  # Replace NAs in the total_batman and total_star_wars columns
  ___ %>%
  inner_join(colors, by = c("color_id" = "id")) 
कोड संपादित करें और चलाएँ