A massive stir in the global political scenario piqued the interests of several data analysts, politicians and global onlookers alike with a revelation made by David Robinson, a data scientist. He recently revealed into the media an analysis of Trump’s tweets, wherein he figured that those that happened from an android device were done by the presidential candidate himself, but those that were done from an iPhone device were done by a campaign staff.
While many may not think too deeply about this minor information, the main distinguishing point about this revelation has something to do with sentiments behind the tweets. The android device based tweets from the candidate himself (Trump) use angrier, more negative words but the iPhone-based tweets tended to be more straightforward ones with campaign announcements and hash tag promotions; something that a simple campaigner with digital marketing and clickbaits in mind would do with their docile mannerisms. The news was initially reported by the Scientific American, PC Magazine, and the LA Times. In fact, David Robinson even gave an interview with Time Magazine about his deductions.
The scientist made use of R language and several handy packages contributed to R to run this analysis on Trump’s Tweets. Here’s a graph showing overall tweet sentiments on Donald Trump’s twitter:
The complete code behind this ingenious analysis is also available for interested data analysts to try their hands on at Github. It is available in the form of an R markdown document which also forms for an excellent specimen of literate programming using R.
David made use of the functions like twitter package and the userTimeline package to download the tweets and the metadata from Donald Trumps’s twitter account, @realDonaldTrump, and this formed the raw data for his analysis.
The process involved usage of tidytext package along with unnest_tokens that were extracted and standardized the individual words from the tweets with which the above mentioned tabulation was obtained that is shown in the graph above. These were done with words that were used more frequently used by the android and iPhone tweets. The package named tidytext was also used to measure the sentiments behind the words used, and the stark difference between the words used with iPhone and Android related to fear, sadness, anger, disgust and surprise and anticipation, joy, and trust.
The time of the day also revealed some relevant factors about the author of the tweet and the sentiments behind them. Here is a graph showing the same:
Further details on David’s analysis on Trump’s tweet and an iPhone-owning campaign staffer attempting to emulate his style of tweeting can be read on the original story published by him, where he opens with a great example of angrier authentic tweets made by the candidate himself.
When Trump wished the Olympic participants luck he was tweeting from an iPhone, but when he insulted rivals he tweeted from an Android!
Interested in a career in Data Analyst?
To learn more about Machine Learning Using Python and Spark – click here.
To learn more about Data Analyst with Advanced excel course – click here.
To learn more about Data Analyst with SAS Course – click here.
To learn more about Data Analyst with R Course – click here.
To learn more about Big Data Course – click here.