View source: R/analyze-network.R
create_edgelist | R Documentation |
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
.
create_edgelist(df, type = "all")
df |
A dataframe returned by |
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". |
A dataframe edgelist defined by interactions through the type of
statuses specified. The dataframe has three columns: sender
,
receiver
, and edge_type
.
example_url <- "18clYlQeJOc6W5QRuSlJ6_v3snqKJImFhU42bRkM_OX8"
tags_content <- read_tags(example_url)
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.