---
title: "Chapter 09 Template"
author: "Roger Beecham"
format: html
---

## Introduction

Reopen your project and save this `.qmd` file in the top-level folder. When working through the materials from this chapter run each code chunk separately by clicking the small green arrow beside each code chunk. By default I have set `eval: false` on most code chunks, so when you knit the code chunk will not execute.


## Setup

The code block below points to the packages you need. 

```{r}
#| echo: true
#| eval: false
library(tidyverse) 
library(sf)
library(here)
```

Bring in the staged Covid-19 case data by US county, as well as the `.geojson` files for US states and counties. Note that the Covid-19 case data were originally collected via the [`covdata`](https://kjhealy.github.io/covdata/) R package.

```{r}
#| echo: true
#| eval: false
url <- "https://vis4sds.github.io/data/ch8/county_data_covid.csv"
download.file(url, here("data", "county_data_covid.csv"))
county_data <- read_csv(here("data", "county_data_covid.csv")) |> 
  # make binned_growth_rate a factor variable.
  mutate(binned_growth_rate=factor(binned_growth_rate)) 

url <- "https://vis4sds.github.io/data/ch8/county_boundaries.geojson"
download.file(url, here("data", "county_boundaries.geojson"))
county_boundaries <- st_read(here("data", "county_boundaries.geojson"))  

url <- "https://vis4sds.github.io/data/ch8/state_boundaries.geojson" 
download.file(url, here("data", "state_boundaries.geojson"))              
state_boundaries <- st_read(here("data", "state_boundaries.geojson"))  
```


