Learn R Programming

vosonSML (version 0.26.3)

vosonSML::AddUserData.twitter: Enhances twitter actor network graph by adding user attributes to nodes

Description

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.

Usage

AddUserData.twitter(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.

Examples

Run this code
# 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 <- AddUserData.twitter(twitterData, actorNetwork,
                                            lookupUsers = TRUE, 
                                            twitterAuth = twitterAuth, writeToFile = TRUE)
# igraph object
# actorNetWithUserAttr$graph
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab