시작하기무료로 시작하기

Load some text

Text mining begins with loading some text data into R, which we'll do with the read.csv() function.

A best practice is to examine the object you read in to make sure you know which column(s) are important. The str() function provides an efficient way of doing this.

If the data frame contains columns that are not text, you may want to make a new object using only the correct column of text (e.g.,some_object$column_name).

Be aware that this is real data from Twitter and as such there is always a risk that it may contain profanity or other offensive content (in this exercise, and any following exercises that also use real Twitter data).

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

Text Mining with Bag-of-Words in R

강의 보기

연습 안내

The data has been loaded for you and is available in coffee_data_file.

  • Create a new object tweets using read.csv() on the file coffee_data_file, which contains tweets mentioning coffee.
  • Examine the tweets object using str() to determine which column has the text you'll want to analyze.
  • Make a new coffee_tweets object using only the text column you identified earlier. To do so, use the $ operator and column name.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Import text data from CSV, no factors
tweets <- ___

# View the structure of tweets
___

# Isolate text from tweets
coffee_tweets <- ___
코드 편집 및 실행