1. 학습
  2. /
  3. 강의
  4. /
  5. dplyr로 데이터 결합하기

Connected

연습 문제

세트 결합하기

이전 연습 문제에서 집계한 데이터가 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))

지침 1/2

undefined XP
    1
    2
  • batman_colors와 star_wars_colors 테이블을 조인하되, 두 테이블의 모든 관측값이 포함되도록 하세요.
  • total_batman과 total_star_wars 열의 NA를 적절한 값으로 대체하세요.