Text mining: Twitter extraction and stepwise guide to generate a word cloud
I have seen many posts, where authors talk about generating a word cloud using tweets but not many talks about how to connect your device to Twitter in order to generate a word cloud. This is very simple but very important step to do (obviously, as we will generate a word cloud using these tweets). Before we start with the technical part, it is important to understand why we need to extract data from Twitter or let us just say from any social media platform like twitter, facebook, LinkedIn etc. Consider that you launched a product or a scheme in the market and you want to analyze what people think about it. This is also called Risk sensing and Sentiment analysis. It helps to determine the sentiment of the population about your product and by analyzing the data from these platforms you can easily know if the review about your product is positive or negative. Believe me, it can help in changing your business strategy also.
So, let’s get started.
Steps to Connect R and twitter:
-
Create a Twitter account. DO NOT FORGET TO ADD YOUR MOBILE NUMBER.
-
Once you have created your account on twitter go to the following link to create your first Twitter app http://apps.twitter.com
-
Click on Create New App. Choose a unique name for your app and provide a brief description of your application. In “Website”, you can provide any of your profile link (I have given my LinkedIn profile link).
-
Click on “Create your Twitter application”. Your application is created
-
Open your application and go to “Keys and Access Tokens” to see your Consumer Key (API key) and Consumer Secret (API Secret) key. I have hidden mine but once you are on this stage you shoud see yours. NOTE BOTH THE KEYS SOMEWHERE.
-
If you are doing this for the first time then you have to scroll down on the same “keys and access tokens” page and generate your Access tokens. NOTE ACCESS TOKEN AND ACCESS TOKEN SECRET ALONG WITH YOUR CONSUMER KEYS.
It is finally time to open your R Studio.
Please go to my R script
You can also refer to my article here: