Performing a Twitter sentiment analysis
Twitter sentiment analysis is another powerful tool in the text analytics toolbox.
With sentiment analysis, we can analyze the mood expressed within a text.
In this recipe, we will download tweets relating to "data science with R" and perform a sentiment analysis on them, employing the bag of word technique.
The main feature of this technique is not trying to understand the meaning of the analyzed text but just looking at one word at the time, seeing whether it expresses a positive or negative sentiment.
Our example will therefore result in computing the overall sentiment around the topic, algebraically summing up the sentiment score of every single word in our bag.
Getting ready
This recipe will leverage powerful ...
Get RStudio for R Statistical Computing Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.