Skip to contents

Starting with a dataframe of Twitter data imported to R with read_tags() and additional metadata retrieved by pull_tweet_data(), create_edgelist() removes any statuses that are not of the requested type (e.g., replies, retweets, and quote tweets) by calling filter_by_tweet_type(). Finally, create_edgelist() pulls out senders and receivers of the specified type of statuses, and then adds a new column called edge_type.

Usage

create_edgelist(df, type = "all")

Arguments

df

A dataframe returned by pull_tweet_data()

type

The specific kind of statuses used to define the interactions around which the edgelist will be built. Choices include "reply", "retweet", or "quote". Defaults to "all".

Value

A dataframe edgelist defined by interactions through the type of statuses specified. The dataframe has three columns: sender, receiver, and edge_type.

Examples


# \donttest{
example_url <- "18clYlQeJOc6W5QRuSlJ6_v3snqKJImFhU42bRkM_OX8"
tags_content <- read_tags(example_url)
#>  Reading from "#aect19 tweet collector".
#>  Range ''Archive''.

if (rtweet::auth_has_default()) {
  tweets_data <- lookup_many_tweets(tags_content)
  full_edgelist <- create_edgelist(tweets_data)
  full_edgelist

  reply_edgelist <- create_edgelist(tweets_data, type = "reply")
  retweet_edgelist <- create_edgelist(tweets_data, type = "retweet")
  quote_edgelist <- create_edgelist(tweets_data, type = "quote")
}
# }