knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 5,
  out.width = "50%",
  fig.align = "center"
)
library(tweetrbot)
library(readr)

Example dataset

rds_file <- system.file("complete_tweets_rspatial.rds", package = "tweetrbot")
all_tweets <- read_rds(rds_file)

Top retweets

In this vignette, I do not really post the tweet. I only retrieve its content.

# get last month data
# In this saved dataset, last month is April
last_month_tweets <- all_tweets %>% filter_month(the_month = 4, the_year = 2020)
# update rds data (not run in this example to not modify raw data)
#  and return last_month updated
last_month_updated <- update_data(
  path = rds_file, 
  statuses = last_month_tweets$status_id, 
  return_all = FALSE,
  overwrite = TRUE)
output <- top_tweets(all_tweets = last_month_updated, post_tweet = FALSE, top_number = 5)
# Data not really updated in this vignette because would need Twitter credentials
output <- all_tweets %>% 
  filter_month(the_month = 4, the_year = 2020) %>% 
  top_tweets(post_tweet = FALSE, top_number = 5)
output$number_contributors
output$top_retweet
output$number_tweets
output$text_tweet


statnmap/tweetrbot documentation built on Oct. 22, 2022, 6:25 p.m.