LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Joining Data with dplyr

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

tagged_answers %>%
  # Aggregate by tag_name
  ___  %>%
  # Summarize questions and average_answers
  summarize(questions = ___,
            average_answers = ___) %>%
  # Sort the questions in descending order
  ___  
Code bearbeiten und ausführen