Description Usage Arguments Details Value See Also Examples
View source: R/as_screenname.R
Coerces user identifier(s) to be evaluated as a screen name(s).
1 2 3 | as_screenname(x)
as_userid(x)
|
x |
A vector consisting of one or more Twitter user identifiers (i.e., screen names or user IDs). |
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.
A vector of class screen_name or class user_id
Other users:
lists_subscribers()
,
lookup_users()
,
search_users()
,
tweets_with_users()
,
users_data()
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.