Juntar contagens de perguntas e respostas
Também podemos determinar quantas perguntas realmente geram respostas. Se contarmos o número de respostas para cada pergunta, poderemos juntar as contagens de respostas com a tabela questions
.
Este exercício faz parte do curso
Unindo dados com o dplyr
Instruções do exercício
- Conte e classifique a coluna
question_id
na tabelaanswers
para criar a tabelaanswer_counts
. - Junte a tabela
questions
com a tabelaanswer_counts
e inclua todas as observações da tabelaquestions
. - Substitua os valores de NA na coluna
n
por 0s.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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
___