1. เรียนรู้
  2. /
  3. Courses
  4. /
  5. dplyr로 데이터 결합하기

Connected

Exercises

각 테마별 집계

이전에 테이블을 결합해 테마를 비교했어요. 비교에 앞서, 각 테마에 포함된 부품과 그 부품의 색상에 대해 더 잘 이해할 수 있도록 데이터를 집계해 보겠습니다.

이전에 생성한 테이블은 inventory_sets_themes로 미리 로드되어 있어요. 각 테마로 필터링된 객체는 batman과 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")

คำแนะนำ

100 XP
  • Batman과 Star Wars의 부품에 대해, 수량(quantity)을 가중치로 하여 부품 번호와 색상 ID를 집계하세요.