How to do it...

To compute important network metrics, follow these steps:

  1. Load the following packages:
> library(twitteR) 
> library(igraph)> library(dplyr)
  1. Set your API keys and secret keys information from the Twitter app and then authenticate using the twitter_oauth method :
> api_key <- <your consumer or api key>> api_secret <- <your api key secret>> access_token <- <your access token>> access_token_secret <- < your access token secret>> setup_twitter_oauth(api_key, api_secret, access_token, access_token_secret)[1] "Using direct authentication"
  1. Now, we will search Twitter based on the keyword, "demonetization", and convert the tweets to a data frame object. Then we will use only the first 500 tweets for demonstration to avoid heavy ...

Get R Data Analysis Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.