neighborhoodVoronoi: Compute Voronoi pump neighborhoods.

View source: R/voronoi.R

neighborhoodVoronoiR Documentation

Compute Voronoi pump neighborhoods.

Description

Group cases into neighborhoods using Voronoi tessellation.

Usage

neighborhoodVoronoi(pump.select = NULL, vestry = FALSE, latlong = FALSE,
  location = "nominal", polygon.vertices = FALSE)

Arguments

pump.select

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

vestry

Logical. TRUE uses the 14 pumps from the Vestry report. FALSE uses the 13 in the original map.

latlong

Logical. Longitude and latitude coordiantes

location

Character. "nominal" or "orthogonal". "nominal" uses the x-y coordinates of fatalities.address. "orthogonal"uses the x-y coordinates of ortho.proj.

polygon.vertices

Logical. TRUE returns a list of x-y coordinates of the vertices of Voronoi cells. Useful for sp::point.in.polygon() as used in print.voronoi() method.

Value

An R list with 12 objects.

  • pump.id: vector of selected pumps

  • voronoi: output from deldir::deldir().

  • snow.colors: neighborhood color based on snowColors().

  • x.rng: range of x for plot.

  • y.rng: range of y for plot.

  • select.string: description of "pump.select" for plot title.

  • expected.data: expected neighborhood fatality counts, based on Voronoi cell area.

  • coordinates: polygon vertices of Voronoi cells.

  • statistic.data: observed neighborhood fatality counts.

  • pump.select: "pump.select" from neighborhoodVoronoi().

  • statistic: "statistic" from neighborhoodVoronoi().

  • vestry: "vestry" from neighborhoodVoronoi().

Examples

## Not run: 
neighborhoodVoronoi()
neighborhoodVoronoi(vestry = TRUE)
neighborhoodVoronoi(pump.select = 6:7)
neighborhoodVoronoi(pump.select = -6)
neighborhoodVoronoi(pump.select = -6, polygon.vertices = TRUE)

# coordinates for vertices also available in the returned object.
dat <- neighborhoodVoronoi(pump.select = -6)
dat$coordinates

## End(Not run)

lindbrook/cholera documentation built on Sept. 17, 2024, 1:41 a.m.