1. Learn
  2. /
  3. Courses
  4. /
  5. Joining Data with dplyr

Exercise

Average answers by question

The table you created in the last exercise has been preloaded for you as tagged_answers. You can use this table to determine, on average, how many answers each questions gets.

tagged_answers <- question_answer_counts %>%
    inner_join(question_tags, by = c("id" = "question_id")) %>%
    inner_join(tags, by = c("tag_id" = "id"))

Some of the important variables from this table include: n, the number of answers for each question, and tag_name, the name of each tag associated with each question.

Let's use some of our favorite dplyr verbs to find out how many answers each question gets on average.

Instructions

100 XP
  • Aggregate the tagged_answers table by tag_name.
  • Summarize tagged_answers to get the count of questions and the average_answers.
  • Sort the resulting questions column in descending order.