ComeçarComece de graça

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

Ver curso

Instruções do exercício

  • Conte e classifique a coluna question_id na tabela answers para criar a tabela answer_counts.
  • Junte a tabela questions com a tabela answer_counts e inclua todas as observações da tabela questions.
  • 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
  ___
Editar e executar o código