Setup

library(tidyverse)
emperors <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-08-13/emperors.csv")
## Parsed with column specification:
## cols(
##   index = col_integer(),
##   name = col_character(),
##   name_full = col_character(),
##   birth = col_date(format = ""),
##   death = col_date(format = ""),
##   birth_cty = col_character(),
##   birth_prv = col_character(),
##   rise = col_character(),
##   reign_start = col_date(format = ""),
##   reign_end = col_date(format = ""),
##   cause = col_character(),
##   killer = col_character(),
##   dynasty = col_character(),
##   era = col_character(),
##   notes = col_character(),
##   verif_who = col_character()
## )

Start

Ideas: - Plot a line graph of the birth and death dates of the emperors - Group by birth city - Look into rise variable - Look at breakdown of cause of death

Explore

glimpse(emperors)
## Observations: 68
## Variables: 16
## $ index       <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,...
## $ name        <chr> "Augustus", "Tiberius", "Caligula", "Claudius", "N...
## $ name_full   <chr> "IMPERATOR CAESAR DIVI FILIVS AVGVSTVS", "TIBERIVS...
## $ birth       <date> 0062-09-23, 0041-11-16, 0012-08-31, 0009-08-01, 0...
## $ death       <date> 0014-08-19, 0037-03-16, 0041-01-24, 0054-10-13, 0...
## $ birth_cty   <chr> "Rome", "Rome", "Antitum", "Lugdunum", "Antitum", ...
## $ birth_prv   <chr> "Italia", "Italia", "Italia", "Gallia Lugdunensis"...
## $ rise        <chr> "Birthright", "Birthright", "Birthright", "Birthri...
## $ reign_start <date> 0026-01-16, 0014-09-18, 0037-03-18, 0041-01-25, 0...
## $ reign_end   <date> 0014-08-19, 0037-03-16, 0041-01-24, 0054-10-13, 0...
## $ cause       <chr> "Assassination", "Assassination", "Assassination",...
## $ killer      <chr> "Wife", "Other Emperor", "Senate", "Wife", "Senate...
## $ dynasty     <chr> "Julio-Claudian", "Julio-Claudian", "Julio-Claudia...
## $ era         <chr> "Principate", "Principate", "Principate", "Princip...
## $ notes       <chr> "birth, reign.start are BCE. Assign negative for c...
## $ verif_who   <chr> "Reddit user zonination", "Reddit user zonination"...

Cause of death

emperors %>%
  group_by(cause) %>%
  summarise(count = n()) %>%
  arrange(desc(count))
## # A tibble: 7 x 2
##   cause          count
##   <chr>          <int>
## 1 Assassination     25
## 2 Natural Causes    21
## 3 Execution          8
## 4 Died in Battle     5
## 5 Suicide            5
## 6 Unknown            3
## 7 Captivity          1

The majority of the emperors were either killed by assassination or natural causes.

emperors %>%
  group_by(cause) %>%
  summarise(count = n()) %>%
  arrange(desc(count)) %>%
  ggplot(aes(reorder(cause, count), count)) +
    geom_col() + 
    labs(x="Cause of Death", y="Death Count", title="How They Died") +
    coord_flip()

Lifespan

emperors %>%
  filter(!is.na(birth), !is.na(death)) %>%
  gather(key = "lifespan", value = "date", birth, death, -name) %>%
  ggplot(aes(date, reorder(name, desc(date)), color = lifespan)) +
    geom_point() +
    labs(x="Year", y="Emperor", title="When Emperors Were Alive")