Description Usage Arguments Value Examples
Create, add users, and destroy Twitter lists
1 2 3 |
users |
Character vectors of users to be added to list. |
name |
Name of new list to create. |
description |
Optional, description of list (single character string). |
private |
Logical indicating whether created list should be private. Defaults to false, meaning the list would be public. Not applicable if list already exists. |
destroy |
Logical indicating whether to delete a list. Either 'list_id' or 'slug' must be provided if 'destroy = TRUE'. |
list_id |
Optional, numeric ID of list. |
slug |
Optional, list slug. |
token |
OAuth token associated with user who owns [or will own] the list of interest. Token must have write permissions! |
Response object from HTTP request.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Not run:
## CNN twitter accounts
users <- c("cnn", "cnnbrk", "cnni", "cnnpolitics", "cnnmoney",
"cnnnewsroom", "cnnspecreport", "CNNNewsource",
"CNNNSdigital", "CNNTonight")
## create CNN-accounts list with 9 total users
(cnn_lst <- post_list(users,
"cnn-accounts", description = "Official CNN accounts"))
## view list in browser
browseURL(sprintf("https://twitter.com/%s/lists/cnn-accounts",
rtweet:::home_user()))
## search for more CNN users
cnn_users <- search_users("CNN", n = 200)
## filter and select more users to add to list
more_users <- cnn_users %>%
subset(verified & !tolower(screen_name) %in% tolower(users)) %>%
.$screen_name %>%
grep("cnn", ., ignore.case = TRUE, value = TRUE)
## add more users to list- note: can only add up to 100 at a time
post_list(users = more_users, slug = "cnn-accounts")
## view updated list in browser (should be around 100 users)
browseURL(sprintf("https://twitter.com/%s/lists/cnn-accounts",
rtweet:::home_user()))
## select users on list without "cnn" in their name field
drop_users <- cnn_users %>%
subset(screen_name %in% more_users & !grepl("cnn", name, ignore.case = TRUE)) %>%
.$screen_name
## drop these users from the cnn list
post_list(users = drop_users, slug = "cnn-accounts",
destroy = TRUE)
## view updated list in browser (should be around 100 users)
browseURL(sprintf("https://twitter.com/%s/lists/cnn-accounts",
rtweet:::home_user()))
## delete list entirely
post_list(slug = "cnn-accounts", destroy = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.