Creates a network from the relations and users dataframes generated by Create. Network is supplemented with additional downloaded twitter user information applied as node attributes.

AddTwitterUserData(collectData, networkData, lookupUsers = TRUE,
  twitterAuth = NULL, writeToFile = FALSE)

Arguments

collectData

A dataframe containing the collected tweet data from the Collect function.

networkData

A named list containing the relations $relations and users $users data returned from the Create actor network function.

lookupUsers

Logical. Lookup user profile information using the twitter API for any users data missing from the collect data set. For example fetches profile information for users that became nodes during network creation because they were mentioned in a tweet but did not author any tweets themselves. Default is TRUE.

twitterAuth

A twitter authentication object from Authenticate.

writeToFile

Logical. If TRUE a data frame of user information and the resulting network graph will be written to file in rds and graphml formats respectively. Default is FALSE.

Value

A named list containing a dataframe with user information $users and an igraph object of the twitter actor network with supplemental user node attributes $graph.

Note

Only supports twitter actor network at this time. Bimodal network support could be achieved by the filtering of the twitter user ids from nodes of other types in the networkData. Refer to S3 methods Authenticate.twitter, Collect.twitter and Create.actor.twitter to first create twitter actor network and data to pass as input into this function.

Examples

# NOT RUN {
# add additional twitter user profile information to actor network graph as node attributes 
# requires twitterAuth from Authenticate, twitterData from Collect and actorNetwork from 
# Create actor network
actorNetWithUserAttr <- AddTwitterUserData(twitterData, actorNetwork,
                                           lookupUsers = TRUE,
                                           twitterAuth = twitterAuth, writeToFile = TRUE)
# igraph object
# actorNetWithUserAttr$graph
# }