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.
# S3 method for timeline.twitter
Collect(
credential,
endpoint,
users = c(),
numTweets = 100,
retryOnRateLimit = TRUE,
writeToFile = FALSE,
verbose = FALSE,
...
)
A tibble object with class names "datasource"
and "twitter"
.
A credential
object generated from Authenticate
with class name "twitter"
.
API endpoint.
Character vector. Specifies one or more twitter users. Can be user names, user ids or a mixture.
Numeric vector. Specifies how many tweets to be collected per user. Defaults to single value of
100
.
Logical. When the API rate-limit is reached should the collection wait and resume when it
resets. Default is TRUE
.
Logical. Write collected data to file. Default is FALSE
.
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
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 soley on retryonratelimit
because it does not handle other common
failure modes like temporarily losing your internet connection.