Last active
April 9, 2019 13:35
-
-
Save romainfrancois/4b4db58742c9b44d76b6befeb5aa61af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rtweet) | |
library(glue) | |
library(rtweet) | |
# likes <- <chr vector of accounts that liked the tweet> | |
# retweets <- <chr vector of accounts that retweeted the tweet> | |
data <- tibble( | |
user = c(likes, retweets), | |
what = rep(c("liked", "retweeted"), c(length(likes), length(retweets))), | |
exclamation = map_chr(user, ~praise::praise("${Exclamation}")), | |
adjective = map_chr(user, ~praise::praise("${adjective}")), | |
emoji = emo::jis %>% filter(group == "Animals & Nature") %>% pull(emoji) %>% sample(length(user)) | |
) | |
tweets <- glue_data(data, | |
"@{user}, you have recently {what} an ad for my #Rcpp course, ", | |
"{adjective} {emoji}, this was hard work.", | |
" But: ", | |
"\n1) another way to learn #Rcpp: https://adv-r.hadley.nz/rcpp.html", | |
"\n2) This @RLadiesGlobal statement: https://blog.rladies.org/post/statement-about-datacamp/" | |
) | |
results <- map(tweets, ~{ | |
cat("-") | |
Sys.sleep(1) | |
post_tweet(.) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment