MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Joining Data with dplyr

Lihat Kursus

Petunjuk latihan

  • Count and sort the question_id column in the answers table to create the answer_counts table.
  • Join the questions table with the answer_counts table and include all observations from the questions table.
  • Replace the NA values in the n column with 0s.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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
  ___
Edit dan Jalankan Kode