行列としての DTM を評価する
整然データを DTM にキャストし、行列として扱って評価する練習をしましょう。
この演習では、Twitter データのより小さなサブセット(tidy_twitter_subset)を使って、もう一度 DTM を作成します。
この演習はコースの一部です
Rで始めるテキスト分析
演習の手順
- ツイートごとの単語出現数を DTM にキャストし、
dtm_twitterに代入します。 dtm_twitterを行列に変換し、matrix_twitterという名前にします。- 行 1〜5、列 90〜95 を出力します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Assign the DTM to dtm_twitter
dtm_twitter <- tidy_twitter_subset %>%
count(word, tweet_id) %>%
# Cast the word counts by tweet into a DTM
___(___)
# Coerce dtm_twitter into a matrix called matrix_twitter
___ <- ___(___)
# Print rows 1 through 5 and columns 90 through 95
___