CommencerCommencer gratuitement

Evaluating a DTM as a matrix

Let's practice casting our tidy data into a DTM and evaluating the DTM by treating it as a matrix.

In this exercise, you will create a DTM again, but with a much smaller subset of the twitter data (tidy_twitter_subset).

Cet exercice fait partie du cours

Introduction to Text Analysis in R

Afficher le cours

Instructions

  • Cast the word counts by tweet into a DTM and assign it to dtm_twitter.
  • Coerce dtm_twitter into a matrix called matrix_twitter.
  • Print rows 1 through 5 and columns 90 through 95.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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
___
Modifier et exécuter le code