Twitter is one of the best sources of text data. In this section, we will extract text data from Twitter using the
#rstats hashtag. After extracting the text, we will clean it and then produce a wordcloud. The required libraries for this particular section are as follows:
To extract data from Twitter, first, we need to connect with the Twitter account through a valid authentication process. The code to authenticate the R session with Twitter to extract data, is as follows:
library(twitteR) # need to provide actual string for each key by replacing xxxx setup_twitter_oauth(consumer_key="xxxx", consumer_secret="xxxx", access_token="xxxx", access_secret="xxxx")
Once the authentication process is complete, we ...