This function get the user IDs (e.g. 1349149096909668363) of given usernames, e.g. "potus".
get_user_id(
usernames,
bearer_token = get_bearer(),
all = FALSE,
keep_na = TRUE
)
character vector containing screen names to be queried
string, bearer token
logical, default FALSE to get a character vector of user IDs. Set it to TRUE to get a data frame, see below
logical, default TRUE to keep usernames that cannot be queried. Set it to TRUE to exclude those usernames. Only useful when all is FALSE
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.
# NOT RUN {
bearer_token <- "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
users <- c("Twitter", "TwitterDev")
get_user_id(users, bearer_token)
# }
Run the code above in your browser using DataLab