How to do it...

To plot social network data using igraph, follow these steps:

  1. Load the data. The following code will restore, from the saved file, a data frame called users.edgelist.upper:
> load("users_edgelist_upper.Rdata") 
  1. The data file that we have provided users.edgelist.upper should now have 1,953 rows of data. Plotting such a network will take too much time--even worse, we will get too dense a plot to get any meaningful information. Just for convenience, we will create a much smaller network by filtering our edge list. We will consider as connected only users who have more than 16 common group memberships and create a far smaller network for illustration only:
> edgelist.filtered <- users.edgelist.upper[users.edgelist.upper$x ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.