as_screenname: Mark a user id as a screen name

View source: R/user_id.R

as_screennameR Documentation

Mark a user id as a screen name

Description

There are two ways to identify a Twitter user: a screen name (e.g. "justinbieber") or a user identifier (e.g. "27260086"). User identifiers look like regular numbers, but are actually 64-bit integers which can't be stored in R's numeric vectors. For this reason, rtweet always returns ids as strings.

Unfortunately this introduces an ambiguity, because user names can also consist solely of numbers (e.g. "123456") so it's not obvious whether a string consisting only of numbers is a screen name or a user id. By default, rtweet will assume its a user id, so if you have a screen name that consists only of numbers, you'll need to use as_screenname() to tell rtweet that it's actually a screen name.

Note that in general, you are best off using user ids; screen names are not static and may change over longer periods of time.

Usage

as_screenname(x)

Arguments

x

A character vector of Twitter screen names.

See Also

Other users: lists_subscribers(), lookup_users(), search_users()

Examples

if (auth_has_default()) {
# Look up user with id 
lookup_users("25594077") 

# Look up user with name 25594077
lookup_users(as_screenname("123456"))
}

rtweet documentation built on July 21, 2022, 5:10 p.m.