Skip to content

Instantly share code, notes, and snippets.

@herbps10
Created February 25, 2018 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herbps10/10789f17eeccdd221ecea61cc343041c to your computer and use it in GitHub Desktop.
Save herbps10/10789f17eeccdd221ecea61cc343041c to your computer and use it in GitHub Desktop.
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