A basic analysis of your network
In this section, we will discuss how to extract Facebook network of friends and some more information about the people in our network.
After completing the app creation and authentication steps, let's move forward and learn to pull some basic network data from Facebook. First, let's find out which friends we have access to, using the following command in R. Let's use the temporary token for accessing the data:
token<- "XXXXXXXXX" friends<- getFriends(token, simplify = TRUE) head(friends) # To see few of your friends
The preceding function will return all our Facebook friends whose data is accessible. Version 1 of the API would allow us to download all the friends' data by default. But in the new version, we have limited access. Since we have set simplify
as TRUE
, we will pull only the username and their Facebook ID. By setting the same parameter to FALSE
, we will be able to access additional data such as gender, location, hometown, profile picture, relationship...