Analysis of President Obama’s Tweets


The onset of social media has enabled the world to get closer. Sharing media, articles and views have led to major influences in our decision making process: be it choosing a candidate to vote, new fashion trends etc. For political leaders this has become a tool to establish a personal brand to engage voters and voice their opinions on important issues. Social media platforms have also been extensively used in elections . Democratic candidate Howard Dean has been credited as the first person in history to run a political campaign online. With the help of web developers, he created a great online presence, which set a precedence for future presidential campaigns. We will look at  the Tweets posted by a President Barack Obama so far.


Frequency of Tweets


We see that a high number of Tweets were sent in 2012. This was the year of the Presidential Elections. He ran against Mitt Romney.

Hashtags Used



The number of hashtags used seems to be haphazard. There is a spike in the number of hashtags used in 2012 in the month of October, before the Presidential Election on 6th November 2012. What were the most popular hashtags?



Sentiments By Year


As expected, we see a spike in the number of Tweets in 2012. Most of President Obama’s Tweets were negative in sentiment. The number of negative tweets spiked up significantly during the year of 2012. Let’s take a look at the month-wise sentiment analysis.


We see a spike in the month of October. This is the month when political leader campaign for themselves or the candidates they support.

The above sentiments were calculated using the RSentiment package available on CRAN.

Frequent Terms Used

This information could give us an idea about the kind of message the President was conveying. Let’s take a look at the yearly trends. 




The year 2007 was the year Senator Obama announced his interest to run for the presidency. The frequent terms include “thinking”,”iowa”,”new”,”debate” . The Presidential campaign consumed most of the information.


The frequent terms used in Tweets in the year 2008 were ‘debate’,’university,’senator’,’town’,’hall’. This reflects the intensive time of debates, rallies, and more debates.



The frequent terms for the year 2009 include ‘reform’,’bill’,’congress’,’president’,’court’.  This year is the first year of the Obama Administration. It took progressive measures to shut the controversial Guantanomo Bay and to work on the healthcare bill, The appointment of Supreme Court Justice Sonia Sotomayor. She is the first Asian origin American woman to become Supreme Court Justice.



The frequent terms in 2010 include ‘address’,’insurance’,’senate’,’health’,’families’. President Obama held his first State of the Union Address in 2010. This year is the year President Obama passed the Patient Protection and Affordable Care Act. This was the first health care reform passed by the Obama Administration.




“house”,”republican”,”congress”,”middle” are amongst the frequent terms used. The White House Correspondence Dinner was held during the month of April. He also spoke at Arlington National Cemetery in honour of the war veterans.




The President incumbent Obama ran his Presidential Campaign leading to a re-election for a second terms. He ran against Republican Nominee Mitt Romney as seen as one of the frequent terms in the chart above. Terms such as ‘america’, ‘women’,’work’,’stand’,’family’ make up the terms for his campaign.



Frequent terms include ‘obamacare’,’insurance’,’reform’,’economy’,’violence’. There was an extensive debate for and against a progressive immigration reform to award amnesty to illegal Hispanic residents. Reduction of gun violence was also the agenda of prime importance for the Administration. The Violence Against Women Reauthorization Act was passed in 2013. 




2014 frequent terms include ‘pay’,’american’,’wage’,’minimum’. The Administration held talks on increasing the federal minimum wage in 2014. 




The Administration concentrated on issues such as climate change , health care and the situation in Syria.

Most Correlated Terms

This network presents a visualization of highly correlated terms (>0.5) . Word correlations are displayed in table form below.




The use of social media platforms such as Facebook and Twitter to talk about Presidential addresses , reforms and the country’s problems helps in making the Administration become more transparent. Through the use of the R programming package and several useful text analysis packages , we were able to develop and study the structure of what the President did  and faced during his two terms.


The code for this project can be found here

Please take a look at David Robinson’s blog for more information about the tidyr package.

Article on Forbes on influence of social media in politics


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s