2020

April 15

Spanish Flu Datasets

I have bundled a few datasets mentioned in Alfred W. Crosby’s (2003) book “America’s Forgotten Pandemic” into an R package. In addition to Crosby’s data, I have also added data on non-pharmaceutical interventions by larger U.S. cities during the 1918 and 1919 outbreak from Howard Markel and colleagues.

The spanishflu package can be used to create figures similar to current COVID-19 figures.

This is a small example on how to do that:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


# load packages
library(pacman)
pacman::p_load("tidyverse","lubridate","ggrepel","paletteer","scales","prismatic")
pacman::p_load_gh("markushlang/spanishflu")

# prepare cumulative counts
flu_curve <- deaths_registered_in_certain_cities %>%
  select(date,city,deaths) %>%
  group_by(city) %>%
  arrange(date) %>%
  mutate(deaths = ifelse(is.na(deaths),0,deaths)) %>%
  mutate(cu_deaths = cumsum(deaths)) %>%
  filter(cu_deaths > 9) %>%
  mutate(days_elapsed = date - min(date),
         end_label = ifelse(date == max(date), city, NA))

# create cumulative deaths plot
flu_curve %>%
  filter(city %in% c("New York","Philadelphia","Chicago",
                     "Boston","Pittsburgh")) %>%
  ggplot(mapping = aes(x = days_elapsed, y = cu_deaths,
         color = city, label = end_label,
         group = city)) +
  geom_line(size = 0.8) +
  geom_text_repel(nudge_x = 1.1,
                  nudge_y = 0.1,
                  segment.color = NA) +
  guides(color = FALSE) +
  theme_minimal() +
  scale_color_manual(values = prismatic::clr_darken(paletteer_d("jcolors::default"), 0.2)) +
  scale_y_continuous(labels = scales::comma_format(accuracy = 1),
                     trans = "log2") +  
  labs(x = "Days Since 10th Confirmed Death",
       y = "Cumulative Number of Deaths (log scale)",
       title = "Cumulative Deaths from the Spanish Flu, Selected U.S. Cities") +
    theme(plot.title = element_text(size = rel(1), face = "bold"),
          axis.text.y = element_text(size = rel(1)),
          axis.title.x = element_text(size = rel(0.75)),
          axis.title.y = element_text(size = rel(0.75)),
          axis.text.x = element_text(size = rel(1)),
          legend.text = element_text(size = rel(1))
          )

Cummulative Deaths from the Spanish Flu

Selected U.S. Cities

April 12

Covid-19 Vaccines

For a few weeks I have tried to keep up with the draft vaccine landscape documents published by the WHO. I figured that if I do this work anyway I might as well bundle the dataset in an R package. The package is called covid19vaccines and contains various updates of the WHO Draft Landscape in a tidy table.

I hope to be able to update the package each week. In building the package I profited from a number of sources:

This post by David F. Kleinschmidt.

Kieran Healy’s beautifully simple nycdogs package.