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

First, we fetch real-time twitter tweets data using authentication keys and tokens and then convert it to a data frame using the twListToDF() method from the twitterR package. Afterward, we use the first 500 tweets as network analysis and visualization is computationally intensive and split it into tweets and reTweets datasets.

Next, we add sender information to the reTweets data frame with the mutate() function from dplyr and use the sender information to create an edge list of the reTweet network.

Then we create the reTweet graph data from the reTweet data frame using the graph_from_data_frame() method from the igraph package, and finally plot the reTweet graph using the plot function. The vertex.size attribute of the

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