시작하기무료로 시작하기

행렬로서 DTM 평가하기

정돈된 데이터를 DTM으로 변환하고, 그 DTM을 행렬처럼 다루어 평가하는 연습을 해봅시다.

이번 연습에서는 트위터 데이터의 훨씬 작은 하위 집합(tidy_twitter_subset)으로 다시 DTM을 만들어요.

이 연습은 강의의 일부입니다

R로 시작하는 텍스트 분석

강의 보기

연습 안내

  • 트윗별 단어 수를 DTM으로 변환하고, 이를 dtm_twitter에 할당하세요.
  • dtm_twittermatrix_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
___
코드 편집 및 실행