Learn R Programming

rtweet (version 0.6.9)

suggested_slugs: Get user [account] suggestions for authenticating user

Description

Returns Twitter's list of suggested user categories.

Usage

suggested_slugs(lang = NULL, token = NULL)

suggested_users(slug, lang = NULL, parse = TRUE, token = NULL)

Arguments

lang

optional Restricts the suggested categories to the requested language. The language must be specified by the appropriate two letter ISO 639-1 representation.

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.

slug

required The short name of list or a category

parse

Logical indicating whether to parse the returned data into a tibble data frame. See details for more on the returned users data.

Value

List of recommended categories which can be passed along as the "slug" parameter in suggested_users

Recommended users

Details

Currently, this parsing process drops all recursive (list) columns, which mostly means you are shorted some entities data. To maximize users data, however, it is recommended to make an additional lookup_users call using the user IDs returned by this function.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
## get slugs
slugs <- suggested_slugs()

## use slugs to get suggested users
suggested_users(slugs$slug[1])

## alternatively, get all users from all slugs in one function
sugs <- all_suggested_users()

## print data
sugs

## for complete users data, lookup user IDs
sugs_usr <- lookup_users(sugs$user_id)

## view users data
sugs_usr

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab