Joining question and answer counts
We can also determine how many questions actually yield answers. If we count the number of answers for each question, we can then join the answers counts with the questions
table.
Diese Übung ist Teil des Kurses
Joining Data with dplyr
Anleitung zur Übung
- Count and sort the
question_id
column in theanswers
table to create theanswer_counts
table. - Join the
questions
table with theanswer_counts
table and include all observations from thequestions
table. - Replace the NA values in the
n
column with 0s.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Count and sort the question id column in the answers table
answer_counts <- answers %>%
___
# Combine the answer_counts and questions tables
questions %>%
___ %>%
# Replace the NAs in the n column
___