cholera (version 0.2.1)

walkingDistance: Compute the walking distance between a case and the nearest (selected) pump.

Description

Compute the shortest walking distance between an observed or "simulated" case and the nearest (selected) pump.

Usage

walkingDistance(x, observed = TRUE, weighted = TRUE, vestry = FALSE,
  pump.select = NULL, unit = NULL)

Arguments

x

Numeric or Integer. Observed cases must be a whole number between 1 and 578. With three exceptions, "Simulated" cases must be a whole number between 1 and 4993: 1) one case, 3334, does not have a valid orthogonal projector to any street; 2) the 20 cases that project onto Falconberg Court and Falconberg Mews (4427, 4428, 4499, 4500, 4501, 4570, 4571, 4572, 4573, 4574, 4643, 4644, 4645, 4646, 4647, 4716, 4717, 4718, 4719, 4720) form an isolate that are "technically" disconnected from the road network and cannot reach any pump; 3) because Adam and Eve Court is also disconnected from the larger road network, the 27 cases that project onto that road can only reach pump 2, which lies on that road. This means that all other cases cannot reach pump 2.

observed

Logical. TRUE for observed cases; FALSE for "regular" simulated cases.

weighted

Logical. Shortest path weighted by road distance.

vestry

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

pump.select

Numeric. Default is NULL and all pumps are considered. Otherwise, selection is done by a vector of numeric IDs: 1 to 13 for link{pumps}; 1 to 14 for pumps.vestry.

unit

Character. Default is NULL, which returns the graph's unit scale. "yard" returns the approximate distance in yards. "meter" returns the approximate distance in meters. Either implies "weighted" is TRUE.

Value

A base R data frame.

See Also

fatalities, simulateFatalities, vignette("pump.neighborhoods")

Examples

Run this code
# NOT RUN {
walkingDistance(1)
walkingDistance(1, observed = FALSE)
walkingDistance(1, pump.select = -7) # exclude pump 7 from consideration.
walkingDistance(1, pump.select = 6)  # path from case 1 to pump 6.
# }

Run the code above in your browser using DataLab