Playing with Twitter Data in R

Twitter Analysis with R

The purpose is to do some analysis of tweets with R and what better start than using the words "Trump" and "Putin".
So, the first step is to create an app in Twitter and then create an application. It is very simple, we just need a description and a name and takes only a few minutes. Once this is done we will need the next information to connect:
  • Consumer key
  • Consumer secret
  • Access Token
  • Access Secret
The elements that we obtained when we created our application on Twitter, will interact with R using OAuth, so we use the function setup_twitter_oauth allowing "twitteR" to get information from our application.

Once we have setup Twitter in R and created the authentication parameters, the next is load some libraries and extract the tweets using JSON and then save them in a data set named df, also compute them to know how many tweets we got from each key word.

Let's start with some analysis.

What emotions are generated?
In order to identify opinions, it is necessary to perform a feeling analysis, using language processing and text analysis after a cleaning process

 We can also get the sentiment from a range of time
What source people use and when do they tweet?
Source
Vol of tweets by minute
R is a powerful data mining tool, that allows us to approach case studies from different statistical approaches, to extract the relevant information, to clean the records and/or unnecessary characters and to prepare the information to be studied.

Comments