1. 学习
  2. /
  3. 课程
  4. /
  5. dplyr로 데이터 결합하기

Connected

练习

태그가 있는 게시물 묶기와 집계하기

이전 연습 문제에서 만든 테이블은 questions_with_tags와 answers_with_tags로 사전 로드되어 있어요. 먼저 이 테이블들을 posts_with_tags라는 하나의 테이블로 결합해 보세요. 정보를 한 테이블로 모은 다음에는, 미리 로드된 lubridate 패키지를 사용해 날짜 변수를 만들어 더 많은 정보를 추가할 수 있어요.

questions_with_tags <- questions %>%
  inner_join(question_tags, by = c("id" = "question_id")) %>%
  inner_join(tags, by = c("tag_id" = "id"))
answers_with_tags <- answers %>%
  inner_join(question_tags, by = "question_id") %>%
  inner_join(tags, by = c("tag_id" = "id"))

说明

100 XP
  • questions_with_tags와 answers_with_tags 테이블을 결합해 posts_with_tags를 만드세요.
  • posts_with_tags 테이블에 year 열을 추가한 다음, type, year, tag_name별로 게시물 수를 집계하세요.