Last week I wrote about doing a sentiment analysis of tweets about the President using Python’s Sentiwordnet and Vader. Today, I switched to R and did a clustering and word cloud of the tweets about President Buhari.
Below are the steps I took:
- I imported all the necessary libraries.
- I connected to Twitter and created a search stream to gather tweets about Buhari
- I saved the results in a csv file with append set to true so I can keep piling up the search results from different time of the day. Then I removed punctuation and stopwords.
- I extracted the most frequently used words and created a word cloud from them. Lastly, I did a clustering of the words.
|The require statements that were struck out were of libraries I didn’t use but forgot take out before the screenshot|
Below is a screenshot of the scrapped tweets.