getNetwork {Rfacebook} | R Documentation |
Extract network of friends of authenticated user
Description
getNetwork
retrieves the list of mutual friendships and returns the
adjacency matrix or edge list for the network representing the neighborhood
of the authenticated user.
Usage
getNetwork(token, format = "edgelist", verbose = TRUE)
Arguments
token |
Either a temporary access token created at
https://developers.facebook.com/tools/explorer or the OAuth token
created with |
format |
Either "edgelist" for a list of edges in the network or "adj.matrix" for an adjacenty matrix of dimensions (n x n), with n being the number of friends, and 0 or 1 indicating whether friend i is also friends with friend j. |
verbose |
logical, default is |
Details
This function requires the use of an OAuth token with extended permissions.
After the introduction of version 2.0 of the Graph API, only friends who are using the application will be returned.
Author(s)
Pablo Barbera pablo.barbera@nyu.edu
See Also
Examples
## Not run:
## See examples for fbOAuth to know how token was created.
## Copy and paste token created at FB Graph API Explorer
token <- "XXXXXX"
mat <- getNetwork(token=token, format="adj.matrix")
library(igraph)
network <- graph.adjacency(mat, mode="undirected")
pdf("network_plot.pdf")
plot(network)
dev.off()
## End(Not run)