Learn R Programming

cholera (version 0.5.1)

walkingDistance: Compute the shortest walking distance between cases and/or pumps.

Description

Compute the shortest walking distance between cases and/or pumps.

Usage

walkingDistance(origin, destination = NULL, type = "case-pump",
  observed = TRUE, weighted = TRUE, vestry = FALSE, unit = "meter",
  time.unit = "second", walking.speed = 5)

Arguments

origin

Numeric or Integer. Numeric ID of case or pump.

destination

Numeric or Integer. Numeric ID(s) of case(s) or pump(s). Exclusion is possible via negative selection (e.g., -7). Default is NULL, which returns closest pump or "anchor" case.

type

Character "case-pump", "cases" or "pumps".

observed

Logical. Use observed or "simulated" expected data.

weighted

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

vestry

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

unit

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

time.unit

Character. "hour", "minute", or "second".

walking.speed

Numeric. Walking speed in km/hr.

Value

An R data frame.

See Also

fatalities, vignette("pump.neighborhoods")

Examples

Run this code
# NOT RUN {
# distance from case 1 to nearest pump.
walkingDistance(1)

# distance from case 1 to pump 6.
walkingDistance(1, 6)

# exclude pump 7 from consideration.
walkingDistance(1, -7)

# distance from case 1 to case 6.
walkingDistance(1, 6, type = "cases")

# distance from pump 1 to pump 6.
walkingDistance(1, 6, type = "pumps")
# }

Run the code above in your browser using DataLab