---
title: "Counts of death by cause"
author: "Duncan Golicher"
date: "1/13/2021"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,warning = FALSE,message = FALSE)
library(tidyverse)
```


```{r}
library(readr)
d <- read_csv("Weekly_Counts_of_Deaths_by_State_and_Select_Causes__2019-2020.csv")[,1:19]
d %>% filter(`Week Ending Date` < max(d$`Week Ending Date`)-15) -> d
names(d)<- gsub(" ","_",names(d))
d$Non_Natural <-d$All_Cause-d$Natural_Cause
names(d)
```


```{r}
d %>% filter(Jurisdiction_of_Occurrence == "United States") %>% ggplot(aes (x=Week_Ending_Date, y=Non_Natural)) + geom_line()
```


```{r}
d %>% filter(Jurisdiction_of_Occurrence == "United States") %>% pivot_longer(cols=5:6) %>%
  
  ggplot(aes (x=Week_Ending_Date,value,col=name)) + geom_line()
```


