Learn R Programming

rtweet (version 0.6.9)

lists_members: Get Twitter list members (users on a given list).

Description

Get Twitter list members (users on a given list).

Get Twitter list memberships (lists containing a given user)

Usage

lists_members(list_id = NULL, slug = NULL, owner_user = NULL,
  n = 5000, cursor = "-1", token = NULL, parse = TRUE, ...)

lists_memberships(user = NULL, n = 200, cursor = "-1", filter_to_owned_lists = FALSE, token = NULL, parse = TRUE, previous_cursor = NULL)

Arguments

list_id

required The numerical id of the list.

slug

required You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_user parameters.

owner_user

optional The screen name or user ID of the user who owns the list being requested by a slug.

n

Specifies the number of results to return per page (see cursor below). For `list_memberships()`, the default and max is 200 per page. Twitter technically allows up to 1,000 per page, but above 200 frequently results in an over capacity error. For `lists_members()`, the default, and max number of users per list, is 5,000.

cursor

optional Breaks the results into pages. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.

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.

parse

Logical indicating whether to convert the response object into an R list. Defaults to TRUE.

...

Other arguments used as parameters in query composition.

user

The user id or screen_name of the user for whom to return results for.

filter_to_owned_lists

When set to true . t or 1 , will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.

previous_cursor

If you wish to use previous cursor instead of next, input value here to override next cursor.

Value

Either a nested list (if parsed) or an HTTP response object.

Details

Due to deleted or removed lists, the returned number of memberships is often less than the provided n value. This is a reflection of the API and not a unique quirk of rtweet.

See Also

Other lists: lists_statuses, lists_subscribers, lists_subscriptions, lists_users

Examples

Run this code
# NOT RUN {
## get list members for a list of polling experts using list_id
(pollsters <- lists_members("105140588"))

## get list members of cspan's senators list
sens <- lists_members(slug = "senators", owner_user = "cspan")
sens

## get list members for an rstats list using list topic slug
## list owner's screen name
rstats <- lists_members(slug = "rstats", owner_user = "scultrera")
rstats

# }
# NOT RUN {
# }
# NOT RUN {
## get up to 1000 Twitter lists that include Nate Silver
ns538 <- lists_memberships("NateSilver538", n = 1000)

## view data
ns538

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab