get_user_id: Get user id

View source: R/get_user_id.R

get_user_idR Documentation

Get user id

Description

This function get the user IDs (e.g. 1349149096909668363) of given usernames, e.g. "potus".

Usage

get_user_id(
  usernames,
  bearer_token = get_bearer(),
  all = FALSE,
  keep_na = TRUE
)

Arguments

usernames

character vector containing screen names to be queried

bearer_token

string, bearer token

all

logical, default FALSE to get a character vector of user IDs. Set it to TRUE to get a data frame, see below

keep_na

logical, default TRUE to keep usernames that cannot be queried. Set it to TRUE to exclude those usernames. Only useful when all is FALSE

Value

a string vector with the id of each of the users unless all = TRUE. If all = TRUE, a data.frame with ids, names (showed on the screen) and usernames is returned.

Examples

## Not run: 
bearer_token <- "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
users <- c("Twitter", "TwitterDev")
get_user_id(users, bearer_token)

## End(Not run)

academictwitteR documentation built on March 18, 2022, 6:41 p.m.