Visualize your Facebook friends network with R

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A few days ago, Romain François explained how to interface with the Facebook Graph API explorer with R. This was a low-level interface, giving the R programmer the ability to the raw data that Facebook can provide about your connections. Now, just four days later, the first application in R (that I know of) based on the Facebook Graph API has been published.

Petr Simecek describes how to use R to visualize your Facebook friends as an interconnected graph. Petr uses Romain's facebook function to download the friends list via the API, and then constructs the friendship graph using the Rgraphviz package. To enhance the presentation, Petr goes one step further and downloads his friend's profile pictures (again, using the Facebook API and the download.file function), and uses the addlogo function (from the pixmap package) to decorate the nodes of the graph with faces. Here's the final result:


To find the R code to create a chart like this for your own Facebook friend network, follow the link to Petr's blog below.

Apply R: Mining Facebook Data: Most “Liked” Status and Friendship Network (via)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)