Skip to contents

Because the Twitter API offers a in_reply_to_status_id_str column, it is possible to iteratively reconstruct reply threads in an upstream direction, that is, retrieving statuses composed earlier than replies in the dataset. The get_upstream_tweets() function collects upstream replies not previously found in the dataset. Keep in mind that there is no way to predict how far upstream you can trace back a reply thread, so running get_upstream_tweets() could take a while and potentially hit the Twitter API rate limit of 90,000 statuses in a 15-minute period.

Usage

get_upstream_tweets(df)

Arguments

df

A dataframe of statuses and full metadata from the Twitter API as returned by pull_tweet_data()

Value

A new, expanded dataframe which includes any retrievable upstream replies

Details

This function requires authentication; please see vignette("setup", package = "tidytags")

See also

Read more about rtweet authentication setup at vignette("auth", package = "rtweet")

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)
  more_replies_df <- get_upstream_tweets(tweets_data)
  more_replies_df
}
# }