---
title: "Kernel Density Plot"
author: "lindbrook"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Kernel Density Plot}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = ">")
library(cholera)
```

By default, the `addKernelDensity()` function pools all observations:

```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = TRUE, eval = FALSE}
snowMap()
addKernelDensity()
```

```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = FALSE, eval = TRUE}
snowMap()
addKernelDensity(multi.core = FALSE)
```

However, this presuppose that all cases have a common source. To consider the possible existence of multiple pump neighborhoods, the function provides two ways to explore hypothetical scenarios.

By using the `pump.select` argument, you can define a "population" of pump neighborhoods by specify the pumps to consider:


```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = TRUE, eval = FALSE}
snowMap()
addKernelDensity(pump.select = c(6, 8))
```

```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = FALSE, eval = TRUE}
snowMap()
addKernelDensity(pump.select = c(6, 8), multi.core = FALSE)
```

By using the `pump.subset` argument, you can define the subset of the "population" to consider:


```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = TRUE, eval = FALSE}
snowMap()
addKernelDensity(pump.subset = c(6, 8))
```

```{r fig.width = 5, fig.height = 5, fig.align = "center", echo = FALSE, eval = TRUE}
snowMap()
addKernelDensity(pump.subset = c(6, 8), multi.core = FALSE)
```
