get_user_tweets: Get a user's tweets for a given date range

Description Usage Arguments Value WARNING

View source: R/get_user_tweets.R

Description

Given a tweet IDs JSON, a user.id, and a start and end date, function looks for existing tweets data and gets tweets for the remaining date range(s) by calling get_all_tweets.

Usage

1
2
3
4
get_user_tweets(ids.file, user.id, since, until,
  token = rtweet::get_token(), .write.out = TRUE, .data.path,
  .file.stem = paste0("tw_user_", user.id, "_tweets_%s.RData"),
  .write.fun = saveRDS, verbose = TRUE)

Arguments

ids.file

path to a tweet IDs JSON (as written by scrape_tweet_ids or get_user_tweet_ids)

user.id

is the user ID of a twitter user

since

a date (format '%Y-%m-%d'), specifying the start of the date range to be requested

until

a date (format '%Y-%m-%d'), specifying the end of the date range to be requested

token

an Twitter OAuth rtweet's 'Token' object. Defaults to rtweet's get_token.

.write.out

logical. write out tweet IDs as JSON to disk? If TRUE (the default), JSON file will be written to path .data.path

.data.path

Path to look at for existing tweet ID files Also the path where new ID files are written if write.out = TRUE.

.file.stem

file name stem (stem ignores date ranges). Defaults to glob 'tw_user_<user.id>_tweets_*.RData'. Used both for looking for existing tweets data files, and to name new ones when writing to disk.

.write.fun

function used to write data output list. Note that you cannot use write.csv or any other table-like writer, as the outputted data is a list object.

verbose

logical. Print out status messages?

Value

A list object with three elements

  1. 'tweets': tibble data frame containing the tweets data.

  2. 'data_pathes': a chracter vector, specifiying the paths of all tweets data files if any exist or new were written

  3. 'failures': tibble data frame reporting warnings and errors raised while trying to get tweets data.

WARNING


haukelicht/twscrape documentation built on Jan. 29, 2020, 3:23 p.m.