follower_matrix: Construct a Twitter follower matrix

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Collect data from the Twitter API and create a follower matrix

Usage

1
follower_matrix(users, method = "friends")

Arguments

users

A character vector of Twitter handles (with no '@' symbol) or user IDs

method

Construct the matrix by gathering either "friends" or "followers" data for each account. "friends" will be faster for accounts with more followers than friends, and vice versa.

Value

A square matrix representing the directed graph of twitter follower relationships. Each entry in the matrix is 1 if the row account is following the column account, otherwise 0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
setup_twitter_oauth(consumer_key = "[your info]",
    consumer_secret = "[your info]",
    access_token = "[your info]",
    access_secret = "[your info]")
users = c("c4ssdotorg", "RoderickTLong", "AynRandInst", "AynRandOrg")
m = follower_matrix(users)

# plot with igraph
library(igraph)
g = graph_from_adjacency_matrix(m, "directed")
plot(g)

## End(Not run)

wmay/pad637utils documentation built on May 4, 2019, 8:45 a.m.