ComeçarComece de graça

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).

Este exercício faz parte do curso

Introduction to Text Analysis in R

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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
___
Editar e executar o código