Instantly share code, notes, and snippets.

Embed
What would you like to do?
isacatinthesink
library(rtweet)
library(tidyverse)
library(stringr)
library(cowplot)
library(grid)
library(jpeg)
g <- rasterGrob(readJPEG("cat.jpg"), interpolate = TRUE)
tmls <- get_timelines("isacatinthesink", n = 10)
ratings <- tmls %>%
select(text) %>%
filter(!str_detect(text, "^@")) %>%
mutate(yes = str_detect(text, "(?i)^yes"),
no = str_detect(text, "(?i)^no"))
result <- ratings %>%
summarize(yes = sum(yes), no = sum(no)) %>%
mutate(no = no - 1, yes = yes + 2) %>%
gather() # There was a retraction, and one that was x2
ggplot(result, aes(x = key, y = value)) +
annotation_custom(g) +
geom_col(fill = "white", alpha = 0.8) +
labs(caption = "Data & photo: @isacatinthesink", title = "391 @isacatinthesink judgements", x = "Cat in the sink?", y = "n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment