Learn R Programming

rtweet (version 0.6.9)

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

Description

Returns data on up to 90,000 Twitter users. To return data on more than 90,000 users, code must be written to iterate through user IDs whilst avoiding rate limits, which reset every 15 minutes.

Usage

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

Arguments

users

User id or screen name of target user.

parse

Logical, indicating whether or not to parse return object into data frame(s).

token

Every user should have their own Oauth (Twitter API) token. By default token = NULL this function looks for the path to a saved Twitter token via environment variables (which is what `create_token()` sets up by default during initial token creation). For instruction on how to create a Twitter token see the tokens vignette, i.e., `vignettes("auth", "rtweet")` or see ?tokens.

Value

A tibble of users data.

See Also

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

Other users: as_screenname, lists_subscribers, search_users, tweets_with_users, users_data

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
## select one or more twitter users to lookup
users <- c(
  "potus", "hillaryclinton", "realdonaldtrump",
  "fivethirtyeight", "cnn", "espn", "twitter"
)

## get users data
usr_df <- lookup_users(users)

## view users data
usr_df

## view tweet data for these users via tweets_data()
tweets_data(usr_df)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab