— Jose Gonzalez

Archive
Politics

Average sentiment score

Twitter simultaneously allows people to be heard and to hear, easily and in real time, bringing with it potentially fascinating and ground breaking insights for anybody trying to take the public’s pulse on a hot issue.  It is almost mandatory that so much benefit comes with its challenges, namely how to process the humongous amounts of data available every minute. Never one to shy away from some super number crunching, this post is the first one of a series on Twitter.

The chart above represents more than 200,000 mentions of the twitter account belonging to Mexico’s President Enrique Peña Nieto during the past 20 days. It is intended as a proxy of how popular the President of Mexico is on Twitter. Every tweet was analyzed and scored as either positive or negative. Then the total number of positive/negative tweets per hour was recorded and divided by the total number of tweets in that hour. The results show, that on average, Peña Nieto has had a positive sentiment score (0.54) but there are severe hourly negative spikes.

If you would like to know more about how the calculations were elaborated, continue reading

Read More

This info-graphic showing the victims of Drones in Pakistan, has been very popular since it was announced by The Economist. Independently of the quality of their data, the presentation method is very novel.

dronespakistan

Read More

On the last couple of months students in Mexico have held protests against the elected president Enrique Peña Nieto. Their movement is called #YoSoy132. I am still wondering what the movement is about… On the one hand, they were related to another presidential candidate Andres Manuel Lopez Obrador. On the other, they claim autonomy  and in the pursue of a fair and clean elections (besides freedom of speech). Due to my curiosity, I did this wordcloud using R to extract the latest 1,500 tweets with the hashtag #YoSoy132 as of July 29th 2012 and map them using the ManyEyes visualization tool from IBM. Unfortunately, this does not give any insight about the movement.

Full Screen Visualization

#Load Package
library(twitteR)

#get the 1,500 most recent tweets mentioning @WorldBank
yoSoy.tweets = searchTwitter('#YoSoy132', n=1500)
length(yoSoy.tweets)
class(yoSoy.tweets)

tweet =yoSoy.tweets[[1]]
class(tweet)
#?status #describes some accessor methods
tweet$getScreenName()
tweet$getText()

#R has several ways to apply functionss iteratively, The plyr package unifies them all with a consistent naming ocnvention. The function name is determined by the input and output data types. We hace a list and would like a simply array output, so we use laply
library(plyr)
yoSoy.text = laply(yoSoy.tweets, function(t) t$getText())
length(yoSoy.text)
head(yoSoy.text,5)
yoSoy.text #Print results
Read More