as_screenname: Mark a user id as a screen name

Description Usage Arguments See Also Examples

View source: R/user_id.R

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

1

Arguments

x

A character vector of twitter screen names.

See Also

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

Examples

1
2
3
4
5
6
7
8
## Not run: 
# Look up user with id 123456 (screen name harperreed)
lookup_users("123456") 

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

## End(Not run)

mkearney/rtweet documentation built on Sept. 29, 2021, 12:01 p.m.