addWalkingPath {cholera} | R Documentation |
Add the shortest walking path between a selected cases or pumps.
Description
Add the shortest walking path between a selected cases or pumps.
Usage
addWalkingPath(origin = 1, destination = NULL, type = "case-pump",
observed = TRUE, weighted = TRUE, vestry = FALSE,
distance.unit = "meter", time.unit = "second", walking.speed = 5,
unit.posts = "distance", unit.interval = NULL, alpha.level = 1)
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 |
type |
Character "case-pump", "cases" or "pumps". |
observed |
Logical. Use observed or "simulated" expected data. |
weighted |
Logical. |
vestry |
Logical. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
unit.posts |
Character. "distance" for mileposts; "time" for timeposts. |
unit.interval |
Numeric. Sets interval between posts: for "distance", the default is 50 meters; for "time", the default is 60 seconds. |
alpha.level |
Numeric. Alpha level transparency for path: a value in [0, 1]. |
Value
An R list with two elements: a character vector of path nodes and a data frame summary.
Note
The function uses a case's "address" (i.e., a stack's "anchor" case) to compute distance. Time is computed using cholera::distanceTime(). Adam and Eve Court, and Falconberg Court and Falconberg Mews, are disconnected from the larger road network; they form two isolated subgraphs. This has two consequences: first, only cases on Adam and Eve Court can reach pump 2 and those cases cannot reach any other pump; second, cases on Falconberg Court and Mews cannot reach any pump. Unreachable pumps will return distances of Inf
. Arrow points represent mileposts or timeposts to the destination.
Examples
streetNameLocator("broad street", zoom = TRUE, highlight = FALSE,
add.subtitle = FALSE)
addWalkingPath(447)