Posts

Showing posts with the label Pre-processing

5.2.8 An Introduction to Text Analytics - Video 5 Pre-Processing in R

Pre-processing the data can be difficult, but, luckily, R's packages provide easy-to-use functions for the most common tasks. In this video, we'll load and process our data in R. In your R console, let's load the data set tweets.csv with the read.csv function. But since we're working with text data here, we need one extra argument, which is stringsAsFactors=FALSE. So we'll call our data set tweets. And we'll use the read.csv function to read in the data file tweets.csv, but then we'll add the extra argument stringsAsFactors=FALSE. You'll always need to add this extra argument when working on a text analytics problem so that the text is read in properly. Now let's take a look at the structure of our data with the str function. We can see that we have 1,181 observations of two variables, the text of the tweet, called Tweet, and the average sentiment score, called Avg for average. The tweet texts are real tweets that we found on the intern...