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.
This exercise is part of the course
Joining Data with dplyr
Exercise instructions
- Aggregate the
tagged_answers
table bytag_name
. - Summarize
tagged_answers
to get the count ofquestions
and theaverage_answers
. - Sort the resulting
questions
column in descending order.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
tagged_answers %>%
# Aggregate by tag_name
___ %>%
# Summarize questions and average_answers
summarize(questions = ___,
average_answers = ___) %>%
# Sort the questions in descending order
___