Learn R Programming

rtweet (version 1.2.1)

lookup_users: Get Twitter users data for given users (user IDs or screen names).

Description

Get Twitter users data for given users (user IDs or screen names).

Usage

lookup_users(
  users,
  parse = TRUE,
  token = NULL,
  retryonratelimit = NULL,
  verbose = TRUE
)

Value

A tibble of users data.

Arguments

users

User id or screen name of target user.

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.

token

Use this to override authentication for a single API call. In many cases you are better off changing the default for all calls. See auth_as() for details.

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.

verbose

Show progress bars and other messages indicating current progress?

References

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup

See Also

Other users: as_screenname(), lists_subscribers(), search_users()

Examples

Run this code

if (auth_has_default()) {
    users <- c("twitter", "rladiesglobal", "_R_Foundation")
    users <- lookup_users(users)
    users

    # latest tweet from each user
    tweets_data(users)
}

Run the code above in your browser using DataLab