Get twitter conference coverage based on a hashtag over time with R twitteR package.
Visualization made with ggplot2, scales and wordcloud packages
./conferenceCoverage.R -a HASTAG -d DATE -l LENGTH [-f MINFILTER -u MAXUSERS -t MAXTWEETS]
- HASTAG is the hastag for the conference (without #)
- DATE is the first day of the conference in YYYY-MM-DD format
- LENGTH is the length in days of the conference
- MINFILTER is the minimum number of tweets/user in the top user graph [default is 3]
- MAXUSERS is the maximum number of users in the top user graph [default is 40]
- MAXTWEETS is the maximum number of tweet/day required by the API [default is 1500]
./conferenceCoverage.R -a JOBIM2016 -d 2016-06-26 -l 5
./conferenceCoverage.R -a JOBIM2016 -d 2016-06-26 -l 5 -f 5 -u 25 -t 1000
In Shell:
sudo apt-get install r-base r-base-dev libxml2-dev libcurl4-openssl-dev curl libcairo-dev
If problems with svglite, check github.com/hadley
In R console:
install.packages("devtools")
install.packages("RCurl")
install.packages("twitteR")
install.packages("ggplot2")
install.packages("tm")
install.packages("scales")
install.packages("wordcloud")
install.packages("optparse")
- Log to your account on twitter.com (or create a new one)
- Go to dev.twitter.com
- Create an app to get a consumerKey and a consumerSecret
In a R console :
library(twitteR)
consumer_key <- 'YOURCONSUMERKEY'
consumer_secret <- 'YOURCONSUMERSECRET'
access_token <- 'YOURACCESSTOKEN'
access_secret <- 'YOURACCESSSECRET'
save(list = c("consumer_key", "consumer_secret", "access_token", "access_secret"), file="cred")
The cred file just created contain all your credentials for Twitter, so don't share it on Github ;-). Now you just had to load it and you can authentify yourself with it.
- Add more stuff:
- Choice of color theme
- Shiny
Script is mostly copied and slightly adapted on Neil and Stephen twitter analysis:
Informations for installing twitteR and RCurl on Ubuntu: