walkingPath | R Documentation |
Compute the shortest walking path between cases and/or pumps.
walkingPath(origin = 1, destination = NULL, type = "case-pump", observed = TRUE, weighted = TRUE, vestry = FALSE, distance.unit = "meter", time.unit = "second", walking.speed = 5, null.origin.landmark = FALSE)
origin |
Numeric or Character. Numeric ID of case or pump. Character landmark name. |
destination |
Numeric or Character. 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. "unit" is meaningful only when "weighted" is TRUE. See |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
null.origin.landmark |
Logical. Consider landmarks when origin = NULL and type = "case-pump". |
An R list with two elements: a character vector of path nodes and a data frame summary.
The function uses a case's "address" (i.e., a stack's "anchor" case) to compute distance. Time is computed using 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".
## Not run: # path from case 1 to nearest pump. walkingPath(1) # path from pump 1 to nearest case. walkingPath(NULL, 1) # path from case 1 to pump 6. walkingPath(1, 6) # exclude pump 7 from consideration. walkingPath(1, -7) # path from case 1 to case 6. walkingPath(1, 6, type = "cases") # path from pump 1 to pump 6. walkingPath(1, 6, type = "pumps") # for multiple cases. lapply(1:3, walkingPath) # path from case 1 to nearest pump. plot(walkingPath(1)) # path from John Snow's residence to Broad Street pump. plot(walkingPath("John Snow", 7)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.