Learn R Programming

cholera (version 0.4.0)

nearestPump: Compute shortest walking distances or paths.

Description

Compute the distance or path from observed or expected cases to nearest pump (or from among selected pumps).

Usage

nearestPump(pump.select = NULL, output = "distance", vestry = FALSE,
  weighted = TRUE, case.set = "observed", unit = NULL,
  multi.core = FALSE)

Arguments

pump.select

Numeric. Pump candidates to consider. Default is NULL: all pumps are used. Otherwise, selection by a vector of numeric IDs: 1 to 13 for pumps; 1 to 14 for pumps.vestry. Negative selection allowed.

output

Character. "distance" or "path".

vestry

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

weighted

Logical. TRUE computes shortest path in terms of road length. FALSE computes shortest path in terms of the number of nodes.

case.set

Character. "observed", "expected", or "snow".

unit

Character. Unit of measurement: "meter" or "yard". Default is NULL, which returns the map's native scale. Meaningful only when "weighted" is TRUE and "output" is "distance". See vignette("roads") for information on unit distances.

multi.core

Logical or Numeric. TRUE uses parallel::detectCores(). FALSE uses one, single core. You can also specify the number logical cores. On Window, only "multi.core = FALSE" is available.

Value

An R data frame or list of 'igraph' paths.