rtweet (version 0.1.7)

get_friends: get_friends

Description

Requests information from Twitter's REST API regarding a user's friend network (i.e., accounts followed by a user). To request information on followers of accounts

Usage

get_friends(user, token = NULL, page = "-1", stringify = TRUE,
  recode_error = FALSE)

Arguments

user

Screen name or user id of target user.

token

OAuth token (1.0 or 2.0). By default token = NULL fetches a non-exhausted token from an environment variable.

page

Numeric or character vector used as cursor value. Default page = -1 specifies first page of json results, or first 5000 friends. Other pages specified via cursor values supplied by Twitter API response object.

stringify

Logical, indicating whether to return user ids as strings (some ids are too long to be read as numeric). Defaults to TRUE.

recode_error

Logical, indicating whether to report errors for missing users. By default recode.errors = FALSE returns API return errors. This argument can be useful when tracking accounts over time. Instead of reporting an error, if you know you have the correct id, setting recode.errors = TRUE will code friend networks as NA.

Value

friends User ids for everyone a user follows.

See Also

https://dev.twitter.com/overview/documentation

Examples

Run this code
# NOT RUN {
# get ids of users followed by the president of the US
pres <- get_friends(user = "potus")
pres

# get ids of users followed by the Environmental Protection Agency
epa <- get_friends(user = "epa")
epa
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab