as_screenname: Coerces user identifier(s) to be evaluated as a screen...

Description Usage Arguments Details Value See Also Examples

Description

Coerces user identifier(s) to be evaluated as a screen name(s).

Usage

1
2
3

Arguments

x

A vector consisting of one or more Twitter user identifiers (i.e., screen names or user IDs).

Details

Default rtweet function behaviors will treat "1234" as a user ID, but the inverse (i.e., treating "2973406683" as a screen name) should rarely be an issue. However, in those cases, users may need to mix both screen names and user IDs. To do so, make sure to combine them as a list (and not a character vector, which will override conflicting user identifier classes). See examples code for example of mixing user IDs with screen names. Note: this only works with certain functions, e.g., get_friends, get_followers.

Value

A vector of class screen_name or class user_id

See Also

Other users: lists_subscribers, lookup_users, search_users, tweets_with_users, users_data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
## get friends list for user with the handle "1234"
get_friends(as_screenname("1234"))

## as_screenname coerces all elements to class "screen_name"
sns <- as_screenname(c("kearneymw", "1234", "jack"))
class(sns)

## print will display user class type
sns

## BAD: combine user id and screen name using c()
users <- c(as_userid("2973406683"), as_screenname("1234"))
class(users)

## GOOD: combine user id and screen name using list()
users <- list(as_userid("2973406683"), as_screenname("1234"))
users

## get friend networks for each user
get_friends(users)


## End(Not run)

ashoksiri/rtweet documentation built on May 8, 2019, 5:55 p.m.