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.
# S3 method for actor.twitter
Create(
datasource,
type,
rmEdgeTypes = NULL,
inclMentions = TRUE,
inclRtMentions = FALSE,
verbose = FALSE,
...
)
Collected social media data with "datasource"
and "twitter"
class names.
Character string. Type of network to be created, set to "actor"
.
Character vector. List of edge types to remove from network. Options are "tweet"
,
"retweet"
, "reply"
and "quote"
. Default is NULL
.
Logical. Create edges for users mentioned or tagged in tweets. Default is TRUE
.
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 FALSE
.
Logical. Output additional information about the network creation. Default is FALSE
.
Additional parameters passed to function. Not used in this method.
Network as a named list of two dataframes containing $nodes
and $edges
.
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).
if (FALSE) {
# 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"
}