addKernelDensity {cholera}R Documentation

Add 2D kernel density contours.

Description

Add 2D kernel density contours based on selected sets of observations.

Usage

addKernelDensity(pump.subset = "pooled", pump.select = NULL,
  neighborhood.type = "walking", data = "unstacked", bandwidth = 0.5,
  color = "black", line.type = "solid", multi.core = TRUE)

Arguments

pump.subset

Character or Numeric: "pooled", "individual", or numeric vector. "pooled" treats all observations as a single set. "individual" is a shortcut for all individual pump neighborhoods. Use of vector of numeric pump IDs to subset from the neighborhoods defined by pump.select. Negative selection possible. NULL selects all pumps in pump.select.

pump.select

Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. NULL selects all pumps.

neighborhood.type

Character. "voronoi" or "walking"

data

Character. Unit of observation: "unstacked" uses fatalities.unstacked; "address" uses fatalities.address; "fatality" uses fatalities.

bandwidth

Numeric. Bandwidth for kernel density estimation.

color

Character. Color of contour lines.

line.type

Character. Line type for contour lines.

multi.core

Logical or Numeric. TRUE uses parallel::detectCores(). FALSE uses one, single core. You can also specify the number logical cores. See vignette("Parallelization") for details.

Value

Add contours to a graphics plot.

Note

This function uses KernSmooth::bkde2D().

Examples

## Not run: 
snowMap()
addKernelDensity()

snowMap()
addKernelDensity("individual")

snowMap()
addKernelDensity(c(6, 8))

snowMap()
addKernelDensity(pump.select = c(6, 8))

## End(Not run)

[Package cholera version 0.7.5 Index]