getNetwork: Extract network of friends of authenticated user

Description Usage Arguments Details Author(s) See Also Examples

View source: R/getNetwork.R

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

1
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 fbOAuth.

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 TRUE, which will print additional information on the console.

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

getFriends, fbOAuth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

Rfacebook documentation built on May 1, 2019, 8:40 p.m.