At long last we come to the end of this series. I confess that I lost interest when–spoiler alert–there was nothing exciting
to report here. But for the sake of symmetry, here in Part III we’ll delve into the tweets themselves with the awesome tidytext
package.
Full disclosure: what follows is basically David Robinson’s brilliant analysis of Trump’s twitter feed with a different twist: instead of examining tweets by source, we’re examining them by party.
We have all the tweets stored in our sen_tweets
object. Using tidytext
and a dash of regular expressions, we’ll unnest each word
within tweets containing “Hillary” or “Clinton”. We’ll do the same with “Donald” and “Trump” in a separate object:
Next we’ll grab the NRC Emotion Lexicon that comes with the tidytext
package:
Question: what kinds of sentiments occur when democratic senators tweet about Hillary?
Question: what kinds of sentiments occur when republican senators tweet about Hillary?
Hmmm, yea, not really anything interesting to see here. How about party sentiments towards Trump?
Democrat:
Republican:
Source: local data frame [10 x 2]
sentiment n
<chr> <int>
1 negative 24
2 positive 19
3 trust 15
4 anger 13
5 surprise 13
6 sadness 12
7 fear 10
8 disgust 8
9 anticipation 6
10 joy 4
Maybe a little more of a sharper contrast. Let’s take a look at the “positive” words that appear in the democrats’ Trump tweets:
[1] "tremendously" "building" "real" "build" "pay" "fair" "share"
[8] "vote" "completely" "public" "reaffirm" "extraordinary" "expect" "deserve"
[15] "candidate" "dear" "proud" "president" "powerful" "proud" "pay"
[22] "god" "tutor" "real" "debate" "supreme" "independence" "clean"
[29] "revolution" "question" "agree"
My intuition is that these are preceded or followed by negations, which complicates text analysis. Also, what was that god tweet? Could have gone a number of ways, but here’s the tweet from Senator Chris Murphy:
Thus ends our series.