
```{r}
library(tidyverse)
library(mdsr)
library(sf)
```

```{r}
mdsr::CholeraDeaths
typeof(mdsr::CholeraDeaths)
class(mdsr::CholeraDeaths)
graphics::plot(CholeraDeaths["Count"])
```
![J. Snow&rsquo;s Cholera Map](https://mdsr-book.github.io/mdsr2e/gfx/1280px-Snow-cholera-map-1.jpg)

```{r}
dsn <- fs::path(fs::path_wd(), "data", "SnowGIS_SHP")
list.files(dsn)
st_layers(dsn)
CholeraDeaths <- st_read(dsn, layer = "Cholera_Deaths")
CholeraDeaths
```

```{r}
library(ggspatial)

plot(CholeraDeaths["Count"])

ggplot(CholeraDeaths) +
  annotation_map_tile(type = "osm", zoomin = 0) +
  geom_sf()
```


```{r}
ggplot(CholeraDeaths) +
  geom_sf()
```

```{r}
library(ggspatial)
ggplot(CholeraDeaths) + 
  annotation_map_tile(type = "osm", zoomin = 0) + 
  geom_sf(aes(size = Count), alpha = 0.7)
```

```{r}
cholera_latlong <- CholeraDeaths %>%
  st_set_crs(27700) %>%
  st_transform(4326)
snow <- ggplot(cholera_latlong) + 
  annotation_map_tile(type = "osm", zoomin = 0) + 
  geom_sf(aes(size = Count))
pumps <- st_read(dsn, layer = "Pumps")
pumps_latlong <- pumps %>% 
  st_set_crs(27700) %>%
  st_transform(4326)
snow +
  geom_sf(data = pumps_latlong, size = 3, color = "red")
```
