Create.actor.twitter {vosonSML} | R Documentation |
Create twitter actor network
Description
Creates a twitter actor network from tweets returned from the twitter search query. Twitter users who have tweeted, retweeted or been mentioned in a tweet are actor nodes. The created network is directed with edges of different types representing retweets, quote tweets, mentions and replies to other users. Users who have tweeted without ties to other users will appear in the network graph as nodes with self-loops.
Usage
## S3 method for class 'actor.twitter'
Create(
datasource,
type,
rmEdgeTypes = NULL,
inclMentions = TRUE,
inclRtMentions = FALSE,
verbose = FALSE,
...
)
Arguments
datasource |
Collected social media data with |
type |
Character string. Type of network to be created, set to |
rmEdgeTypes |
Character vector. List of edge types to remove from network. Options are |
inclMentions |
Logical. Create edges for users mentioned or tagged in tweets. Default is |
inclRtMentions |
Logical. Create edges for users mentioned or tagged in retweets. For tweet types other than
retweets the collected tweet author has created the mention, for retweets the original tweet author has created the
mention not the retweeter. Default is |
verbose |
Logical. Output additional information about the network creation. Default is |
... |
Additional parameters passed to function. Not used in this method. |
Value
Network as a named list of two dataframes containing $nodes
and $edges
.
Note
When creating twitter actor networks, a network with additional user information can be generated using the
AddUserData
function. Additional calls can be made to the twitter API to get information about users
that were identified as nodes during network creation but did not tweet (meaning no user profile information was
initially collected for them).
Examples
## Not run:
# create a twitter actor network excluding retweet, quote tweets and mention edges
actor_net <- twitter_data |>
Create("actor", rmEdgeTypes = c("retweet", "quote"))
# network nodes and edges
names(actor_net)
# "nodes", "edges"
names(actor_net$nodes)
# "user_id", "screen_name"
names(actor_net$edges)
# "from", "to", "status_id", "created_at", "edge_type"
## End(Not run)