rtweet (version 0.7.0)

suggested_slugs: Get user [account] suggestions for authenticating user

Description

Returns Twitter's list of suggested user categories.

Returns users data for all users in Twitter's suggested categories.

Usage

suggested_slugs(lang = NULL, token = NULL)

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

suggested_users_all(slugs = NULL, parse = TRUE, token = NULL)

Value

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

Recommended users

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.

slugs

Optional, one or more slugs returned by suggested_slugs. API rate limits this to 15 max (function will return warnings for slugs provided beyond the remaining limit).

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

if (FALSE) {

## 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

}

Run the code above in your browser using DataCamp Workspace