O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required