View source: R/analyze-network.R
filter_by_tweet_type | R Documentation |
Starting with a dataframe of Twitter data imported to R with
read_tags()
and additional metadata retrieved by
pull_tweet_data()
, filter_by_tweet_type()
processes the
statuses by calling process_tweets()
and then removes any statuses
that are not of the requested type (e.g., replies, retweets, and quote
tweets). filter_by_tweet_type()
is a useful function in itself, but it is
also used in create_edgelist()
.
filter_by_tweet_type(df, type)
df |
A dataframe returned by |
type |
The specific kind of statuses that will be kept in the dataset
after filtering the rest. Choices for |
A dataframe of processed statuses and fewer rows that the input dataframe. Only the statuses of the specified type will remain.
example_url <- "18clYlQeJOc6W5QRuSlJ6_v3snqKJImFhU42bRkM_OX8"
tags_content <- read_tags(example_url)
if (rtweet::auth_has_default()) {
tweets_data <- lookup_many_tweets(tags_content)
only_replies <- filter_by_tweet_type(tweets_data, "reply")
only_retweets <- filter_by_tweet_type(tweets_data, "retweet")
only_quote_tweets <- filter_by_tweet_type(tweets_data, "quote")
only_originals <- filter_by_tweet_type(tweets_data, "original")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.