Thursday 21 April 2016

Water Water Everywhere and Not a Drop to Drink -Making Use of Social Media Data (Part 2)

The reason I chose this title "Water Water Everywhere and Not a Drop to Drink", and I should have explained this in the first post is to stress the that we have large amounts of useful data in social media and yet it's being under utilized. On my last post on this series I promised that I will use data mined from Twitter to get a fact based insight on any topic being discussed on the micro-blogging platform.

I will guide you on how to build a word cloud from text data mined on Twitter using R . Do not worry this post is not about R and for those who are scared of programming I am working on a shiny app that will help you generate word cloud from Twitter and giving you the option to download it.
Visit this link to see the prototype https://gabrielmutua.shinyapps.io/word_cloud/ still under development.

The first step is to go to visit https://apps.twitter.com/ and create a new app. Note that you must have a Twitter account to create a Twitter App. After creating  the app successfully you will be directed to this page.

Rpraticemutua is the name of the App I have created

Secondly , assuming already you have the recent version of R . Make sure you load(or install) the following packages in R.


 
The go to back to you Twitter app and go Key and Access tokens. This Access Tokens will authorize R to be connected to Twitter API.

We will need this two keys

Never share this details to the public it can be used to hack into your Twitter Account. With this details for example I can update your twitter status. We will also require the following access tokens.

We will also require the following access tokens

From R we can use this code to connect it with Twitter. Note that we have searched 100 tweets on the trending topic #HappyBirthdayYourMajesty which a written in English.

We will later clean the data and plot a word cloud on the next post. Note you can view the obtained tweets by viewing the object my_tweets.

No comments:

Post a Comment