Created
February 25, 2018 23:48
-
-
Save herbps10/10789f17eeccdd221ecea61cc343041c to your computer and use it in GitHub Desktop.
isacatinthesink
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(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