From the course: Text Analytics and Predictions with R Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Finding sentiment

Finding sentiment - R Tutorial

From the course: Text Analytics and Predictions with R Essential Training

Start my 1-month free trial

Finding sentiment

- [Instructor] For this sentiment analysis example, we will use the file Movie-Reviews.txt which is available under the reviews directory in the Exercise Files. This file contains reviews by various users for the "Captain Marvel" movie. We will find the polarity and emotions of these reviews in this chapter. The code for this chapter is available in the file code_02_XX Sentiment Analysis.R. Let's look at the code now to see what data preparation we need to do. We need the sentimentr, data.table and plyer packages for this exercise. I'm going to now install the sentimentr package which will install the other two also. It has been successfully installed. Now we can load all the packages. Let's look at the code now. First, we need to load the Movie-Reviews.txt file into a character vector. This provides an element for each line in the file. Next, we break up these lines into individual sentences using the get_sentences…

Contents