Collect.timeline.twitter: Collect tweet data from twitter timelines

View source: R/Collect.timeline.twitter.R

Collect.timeline.twitterR Documentation

Collect tweet data from twitter timelines

Description

This function collects user timeline tweets and structures the data into a dataframe with the class names "datasource" and "twitter". The Twitter API limits collection to a maximum of 3,200 of the most recent timeline tweets per user.

Usage

## S3 method for class 'timeline.twitter'
Collect(
  credential,
  endpoint,
  users = c(),
  numTweets = 100,
  retryOnRateLimit = TRUE,
  writeToFile = FALSE,
  verbose = FALSE,
  ...
)

Arguments

credential

A credential object generated from Authenticate with class name "twitter".

endpoint

API endpoint.

users

Character vector. Specifies one or more twitter users. Can be user names, user ids or a mixture.

numTweets

Numeric vector. Specifies how many tweets to be collected per user. Defaults to single value of 100.

retryOnRateLimit

Logical. When the API rate-limit is reached should the collection wait and resume when it resets. Default is TRUE.

writeToFile

Logical. Write collected data to file. Default is FALSE.

verbose

Logical. Output additional information about the data collection. Default is FALSE.

...

Arguments passed on to rtweet::get_timeline

since_id

Supply a vector of ids or a data frame of previous results to find tweets newer than since_id.

parse

If TRUE, the default, returns a tidy data frame. Use FALSE to return the "raw" list corresponding to the JSON returned from the Twitter API.

check

[Deprecated]

retryonratelimit

If TRUE, and a rate limit is exhausted, will wait until it refreshes. Most Twitter rate limits refresh every 15 minutes. If FALSE, and the rate limit is exceeded, the function will terminate early with a warning; you'll still get back all results received up to that point. The default value, NULL, consults the option rtweet.retryonratelimit so that you can globally set it to TRUE, if desired.

If you expect a query to take hours or days to perform, you should not rely solely on retryonratelimit because it does not handle other common failure modes like temporarily losing your internet connection.

Value

A tibble object with class names "datasource" and "twitter".


vosonlab/vosonSML documentation built on April 28, 2024, 6:26 a.m.