Skip to content

Instantly share code, notes, and snippets.

@ikashnitsky
Created May 6, 2020 10:33
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 ikashnitsky/878b204e90c25e173ac69b839a383d0f to your computer and use it in GitHub Desktop.
Save ikashnitsky/878b204e90c25e173ac69b839a383d0f to your computer and use it in GitHub Desktop.
Andrew Noymer's US death tolls gut-check estimates published daily on Twitter
#===============================================================================
# 2020-05-06 -- twitter
# Andrew Noymer's update of the total US covid deaths
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(rtweet)
library(httr)
library(tidyverse)
library(hrbrthemes)
library(ggdark)
options(scipen = 9999)
raw <- get_timeline(user = "AndrewNoymer", n = 3200)
est <- raw %>%
filter(text %>% str_detect("gut-check"),
text %>% str_detect("VERY")) %>%
transmute(
created_at,
estimate = text %>%
str_sub(-52, -1) %>%
str_remove_all(",") %>%
str_extract("(\\d)+") %>%
as.numeric()
)
est %>%
ggplot(aes(created_at, estimate))+
geom_path()+
geom_point()+
scale_y_comma(limits = c(0, 1.4e6))+
dark_theme_minimal(base_family = font_rc)+
labs(x = NULL, y = "Estimate",
title = "Andrew Noymer's US death tolls gut-check estimate")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment