質問と回答数の結合
実際に回答がついた質問がどれくらいあるかも確認できます。各質問に対する回答数を数え、questionsテーブルにその回答数(answer_counts)を結合してみましょう。
この演習はコースの一部です
dplyr で行うデータの結合
演習の手順
answersテーブルのquestion_id列を集計して並べ替え、answer_countsテーブルを作成します。questionsテーブルとanswer_countsテーブルを結合し、questionsテーブルのすべての行を含めます。n列のNAを0に置き換えます。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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
___