Create.actor.twitter: Create twitter actor network

View source: R/Create.actor.twitter.R

Create.actor.twitterR 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 "datasource" and "twitter" class names.

type

Character string. Type of network to be created, set to "actor".

rmEdgeTypes

Character vector. List of edge types to remove from network. Options are "tweet", "retweet", "reply" and "quote". Default is NULL.

inclMentions

Logical. Create edges for users mentioned or tagged in tweets. Default is TRUE.

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 FALSE.

verbose

Logical. Output additional information about the network creation. Default is FALSE.

...

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)


vosonSML documentation built on Aug. 16, 2022, 5:14 p.m.