Title: | Amend, Augment and Aid Analysis of John Snow's Cholera Map |
---|---|
Description: | Amends errors, augments data and aids analysis of John Snow's map of the 1854 London cholera outbreak. |
Authors: | lindbrook [aut, cre] |
Maintainer: | lindbrook <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.8.0.9486 |
Built: | 2024-11-26 22:22:42 UTC |
Source: | https://github.com/lindbrook/cholera |
Amend errors, augment data and aid analysis of John Snow's map of the 1854 London cholera outbreak.
Fixes two sets of errors in Dodson and Tobler's 1992 digitization of Snow's map: 1) three misplaced cases/fatalities and 2) one missing road segment (part of Clifford Street).
"Unstacks" the data in two ways to make analysis and visualization easier and more meaningful.
Computes and visualizes "pump neighborhoods" based on Voronoi tessellation, Euclidean distance, and walking distance.
Overlay graphical elements and features like kernel density estimates, Voronoi diagrams, Snow's Broad Street neighborhood, and notable landmarks (John Snow's residence, the Lion Brewery, etc.) via 'add*()' functions.
Includes a variety of functions to highlight specific cases, roads, pumps and paths.
Appends actual street names to roads data.
Includes the revised pump data used in the second version of Snow's map from the Vestry report, which includes the "correct" location of the Broad Street pump.
Adds two different aggregate time series fatalities data sets, taken from the Vestry report.
Support for parallel computation on Linux, macOS and Windows.
With 'cholera' version >= 0.8.0, preliminary and provisional support for georeferenced (longitude and latitude) versions of data and functions.
To learn more, see the vignettes:
vignette("duplicate.missing.cases")
vignette("kernel.density")
vignette("parallelization")
vignette("pump.neighborhoods")
vignette("roads")
vignette("tiles.polygons")
vignette("time.series")
vignette("unstacking.bars")
Maintainer: lindbrook [email protected]
Useful links:
Add case(s), as "anchor", "fatality" or "orthogonal" as points or IDs, to a plot.
addCase(case = 1, latlong = FALSE, type = "observed", token = "both", text.size = 0.5, pch = 1, cex = 1, point.lwd = 2, col = "black", pos = 1)
addCase(case = 1, latlong = FALSE, type = "observed", token = "both", text.size = 0.5, pch = 1, cex = 1, point.lwd = 2, col = "black", pos = 1)
case |
Numeric or Character. Vector of case ID(s). "anchor" plots anchor cases; "fatality" plots all cases; "orthogonal" plot projected addresses. |
latlong |
Logical. |
type |
Character. Type of case: "observed" or "expected". |
token |
Character. Type of token to plot: "point", "id" or "both". |
text.size |
Numeric. Size of case ID text. |
pch |
Numeric. pch. |
cex |
Numeric. cex. |
point.lwd |
Numeric. Point lwd. |
col |
Character. Color. |
pos |
Numeric. Text position. |
type, token, text.size, pch, cex, point.lwd and pos relevant only when case is numeric.
snowMap(add.cases = FALSE) addCase(1) snowMap(add.cases = FALSE) addCase(100)
snowMap(add.cases = FALSE) addCase(1) snowMap(add.cases = FALSE) addCase(100)
Add Delaunay triangles.
addDelaunay(pump.select = NULL, vestry = FALSE, color = "black", line.type = "solid", line.width = 1, latlong = FALSE)
addDelaunay(pump.select = NULL, vestry = FALSE, color = "black", line.type = "solid", line.width = 1, latlong = FALSE)
pump.select |
Numeric. Default is NULL; all pumps are used. Otherwise, selection by a vector of numeric IDs: 1 to 13 for |
vestry |
Logical. |
color |
Character. Color of triangle edges. |
line.type |
Character. Type of line for triangle edges. |
line.width |
Numeric. Width of cell edges: lwd. |
latlong |
Logical. Use estimated longitude and latitude. |
This function uses deldir::deldir()
.
snowMap() addDelaunay()
snowMap() addDelaunay()
Add Euclidean path from case/landmark to nearest or selected pump. (prototype)
addEuclideanPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1)
addEuclideanPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1)
origin |
Numeric. Vector of origin(s) (numeric ID or character name landmark/pump ). |
destination |
Numeric. Vector of destination(s) (numeric or landmark/pump name). |
type |
Character. Path case to pump. FALSE is all other combinations of cases, landmarks and pumps. |
vestry |
Logical. |
latlong |
Logical. |
case.set |
Character. "observed" or "expected". |
location |
Character. For cases and pumps. "nominal", "anchor" or "orthogonal". |
weighted |
Logical. |
distance.unit |
Character. Unit of distance: "meter" or "yard". |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
include.landmarks |
Logical. Include landmarks as cases. |
mileposts |
Logical. Plot mile/time posts. |
milepost.unit |
Character. "distance" or "time". |
milepost.interval |
Numeric. Mile post interval unit of distance (yard or meter) or unit of time (seconds). |
alpha.level |
Numeric. Alpha level transparency for path: a value in [0, 1]. |
Add map border to plot.
addFrame(latlong = FALSE, col = "black", ...)
addFrame(latlong = FALSE, col = "black", ...)
latlong |
Logical. Use estimated longitude and latitude. |
col |
Character. Color |
... |
Additional plotting parameters. |
Highlight index case at 40 Broad Street.
addIndexCase(latlong = FALSE, cex = 2, col = "red", pch = 1, add.label = FALSE, text.size = 0.5)
addIndexCase(latlong = FALSE, cex = 2, col = "red", pch = 1, add.label = FALSE, text.size = 0.5)
latlong |
Logical. |
cex |
Numeric. Size of point. |
col |
Character. Color of point. |
pch |
Numeric. Type of of point. |
add.label |
Logical. Add text annotation: "40 Broad Street" |
text.size |
Numeric. Size of text label. |
Add base R point and (optionally) text to a graphics plot.
segmentLocator("216-1") addIndexCase()
segmentLocator("216-1") addIndexCase()
Add 2D kernel density contours based on selected sets of observations.
addKernelDensity(pump.subset = "pooled", pump.select = NULL, neighborhood.type = "walking", data = "unstacked", bandwidth = 0.5, color = "black", line.type = "solid", multi.core = FALSE, latlong = FALSE)
addKernelDensity(pump.subset = "pooled", pump.select = NULL, neighborhood.type = "walking", data = "unstacked", bandwidth = 0.5, color = "black", line.type = "solid", multi.core = FALSE, latlong = FALSE)
pump.subset |
Character or Numeric: "pooled", "individual", or numeric vector. "pooled" treats all observations as a single set. "individual" is a shortcut for all individual pump neighborhoods. Use of vector of numeric pump IDs to subset from the neighborhoods defined by |
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
neighborhood.type |
Character. "voronoi" or "walking" |
data |
Character. Unit of observation: "unstacked" uses |
bandwidth |
Numeric. Bandwidth for kernel density estimation. |
color |
Character. Color of contour lines. |
line.type |
Character. Line type for contour lines. |
multi.core |
Logical or Numeric. |
latlong |
Logical. |
Add contours to a graphics plot.
This function uses KernSmooth::bkde2D()
.
## Not run: snowMap() addKernelDensity() snowMap() addKernelDensity("individual") snowMap() addKernelDensity(c(6, 8)) snowMap() addKernelDensity(pump.select = c(6, 8)) ## End(Not run)
## Not run: snowMap() addKernelDensity() snowMap() addKernelDensity("individual") snowMap() addKernelDensity(c(6, 8)) snowMap() addKernelDensity(pump.select = c(6, 8)) ## End(Not run)
Add landmarks to plot.
addLandmarks(text.size = 0.5, text.col = "black", highlight.perimeter = TRUE, latlong = FALSE)
addLandmarks(text.size = 0.5, text.col = "black", highlight.perimeter = TRUE, latlong = FALSE)
text.size |
Numeric. cex for text labels. |
text.col |
Character. col for text labels. |
highlight.perimeter |
Logical. Highlight Lion Brewery and Model Housing. |
latlong |
Logical. Use estimated longitude and latitude. |
Base R points and text.
The location of 18 Sackville Street and 28 Dean Street are approximate. Falconberg Court & Mews form an isolate: they are not part of the network of roads and are technically unreachable. Adam and Eve Court and its pump also form an isolate.
snowMap(add.landmarks = FALSE) addLandmarks()
snowMap(add.landmarks = FALSE) addLandmarks()
Add Golden and Soho Squares to plot.
addLandmarkSquares(latlong = FALSE, text.size = 0.5, text.col = "black")
addLandmarkSquares(latlong = FALSE, text.size = 0.5, text.col = "black")
latlong |
Logical. Use estimated longitude and latitude. |
text.size |
Numeric. cex for text labels. |
text.col |
Character. col for text labels. |
Base R points and text.
snowMap() addLandmarkSquares()
snowMap() addLandmarkSquares()
Add distance or time based "mileposts" to an observed walking neighborhood plot.
addMilePosts(pump.subset = NULL, pump.select = NULL, vestry = FALSE, unit = "distance", interval = NULL, walking.speed = 5, type = "arrows", multi.core = TRUE, dev.mode = FALSE)
addMilePosts(pump.subset = NULL, pump.select = NULL, vestry = FALSE, unit = "distance", interval = NULL, walking.speed = 5, type = "arrows", multi.core = TRUE, dev.mode = FALSE)
pump.subset |
Numeric. Vector of numeric pump IDs to subset from the neighborhoods defined by |
pump.select |
Numeric. Numeric vector of pumps to define possible pump neighborhoods (i.e. the "population"). Negative selection is possible. NULL selects all "observed" pumps (i.e., pumps with at least one case). |
vestry |
Logical. |
unit |
Character. Milepost unit of measurement: "distance" or "time". |
interval |
Numeric. Interval between mileposts: 50 meters for "distance"; 60 seconds for "time". |
walking.speed |
Numeric. Walking speed in km/hr. |
type |
Character. "arrows" or "points". |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
R base graphics arrows or points.
Add cases to a plot as "nominal" or "fatalities" and as points or IDs.
addNeighborhoodCases(pump.subset = NULL, pump.select = NULL, metric = "walking", case.set = "observed", location = "nominal", token = "point", text.size = 0.5, pch = 16, point.size = 0.5, vestry = FALSE, weighted = TRUE, color = NULL, alpha.level = 0.5, latlong = FALSE, multi.core = TRUE)
addNeighborhoodCases(pump.subset = NULL, pump.select = NULL, metric = "walking", case.set = "observed", location = "nominal", token = "point", text.size = 0.5, pch = 16, point.size = 0.5, vestry = FALSE, weighted = TRUE, color = NULL, alpha.level = 0.5, latlong = FALSE, multi.core = TRUE)
pump.subset |
Numeric. Vector of numeric pump IDs to subset from the neighborhoods defined by |
pump.select |
Numeric. Numeric vector of pump IDs that define which pump neighborhoods to consider (i.e., specify the "population"). Negative selection possible. |
metric |
Character. Type of neighborhood: "euclidean" or "walking". |
case.set |
Character. "observed" or "expected". |
location |
Character. "nominal", "anchor" or "orthogonal". |
token |
Character. Type of token to plot: "point" or "id". |
text.size |
Numeric. Size of case ID text. |
pch |
Numeric. |
point.size |
Numeric. |
vestry |
Logical. |
weighted |
Logical. |
color |
Character. Use a single color for all paths. |
alpha.level |
Numeric. Alpha level transparency for area plot: a value in [0, 1]. |
latlong |
Logical. Longitude and latitude coordinates. |
multi.core |
Logical or Numeric. |
## Not run: snowMap(add.cases = FALSE) addNeighborhoodCases() snowMap(add.cases = FALSE) addNeighborhoodCases(pump.subset = c(6, 10)) snowMap(add.cases = FALSE) addNeighborhoodCases(pump.select = c(6, 10)) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(latlong = TRUE) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(pump.subset = c(6, 10), latlong = TRUE) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(pump.select = c(6, 10), latlong = TRUE) ## End(Not run)
## Not run: snowMap(add.cases = FALSE) addNeighborhoodCases() snowMap(add.cases = FALSE) addNeighborhoodCases(pump.subset = c(6, 10)) snowMap(add.cases = FALSE) addNeighborhoodCases(pump.select = c(6, 10)) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(latlong = TRUE) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(pump.subset = c(6, 10), latlong = TRUE) snowMap(add.cases = FALSE, latlong = TRUE) addNeighborhoodCases(pump.select = c(6, 10), latlong = TRUE) ## End(Not run)
Add expected Euclidean pump neighborhoods.
addNeighborhoodEuclidean(pump.subset = NULL, pump.select = NULL, vestry = FALSE, location = "nominal", type = "star", alpha.level = 0.5, multi.core = TRUE, dev.mode = FALSE)
addNeighborhoodEuclidean(pump.subset = NULL, pump.select = NULL, vestry = FALSE, location = "nominal", type = "star", alpha.level = 0.5, multi.core = TRUE, dev.mode = FALSE)
pump.subset |
Numeric. Vector of numeric pump IDs to subset from the neighborhoods defined by |
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
vestry |
Logical. |
location |
Character. "nominal" or "orthogonal". "orthogonal" is the x-y coordinates of |
type |
Character. Type of plot: "star", "area.points" or "area.polygons". |
alpha.level |
Numeric. Alpha level transparency for area plot: a value in [0, 1]. |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
R graphic elements.
## Not run: streetNameLocator("marshall street", zoom = 0.5, highlight = FALSE, add.subtitle = FALSE) addNeighborhoodEuclidean() streetNameLocator("marshall street", zoom = 0.5, highlight = FALSE, add.subtitle = FALSE) addNeighborhoodEuclidean(type = "area.points") ## End(Not run)
## Not run: streetNameLocator("marshall street", zoom = 0.5, highlight = FALSE, add.subtitle = FALSE) addNeighborhoodEuclidean() streetNameLocator("marshall street", zoom = 0.5, highlight = FALSE, add.subtitle = FALSE) addNeighborhoodEuclidean(type = "area.points") ## End(Not run)
Add expected walking neighborhoods.
addNeighborhoodWalking(pump.select = NULL, pump.subset = NULL, vestry = FALSE, weighted = TRUE, path = NULL, path.color = NULL, path.width = 3, alpha.level = 0.25, polygon.type = "solid", polygon.col = NULL, polygon.lwd = 2, multi.core = TRUE, dev.mode = FALSE, latlong = FALSE)
addNeighborhoodWalking(pump.select = NULL, pump.subset = NULL, vestry = FALSE, weighted = TRUE, path = NULL, path.color = NULL, path.width = 3, alpha.level = 0.25, polygon.type = "solid", polygon.col = NULL, polygon.lwd = 2, multi.core = TRUE, dev.mode = FALSE, latlong = FALSE)
pump.select |
Numeric. Numeric vector of pump IDs that define which pump neighborhoods to consider (i.e., specify the "population"). Negative selection possible. |
pump.subset |
Numeric. Vector of numeric pump IDs to subset from the neighborhoods defined by |
vestry |
Logical. |
weighted |
Logical. |
path |
Character. "expected" or "observed". |
path.color |
Character. Use a single color for all paths. |
path.width |
Numeric. Set width of paths. |
alpha.level |
Numeric. Alpha level transparency for area plot: a value in [0, 1]. |
polygon.type |
Character. "perimeter" or "solid". |
polygon.col |
Character. |
polygon.lwd |
Numeric. |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
latlong |
Logical. Use estimated longitude and latitude. |
## Not run: streetNameLocator("marshall street", zoom = 0.5) addNeighborhoodWalking() ## End(Not run)
## Not run: streetNameLocator("marshall street", zoom = 0.5) addNeighborhoodWalking() ## End(Not run)
Draws a polygon that approximates the plague pit located around Marshall Street. From Vestry Report map.
addPlaguePit(color = "black", line.type = "solid")
addPlaguePit(color = "black", line.type = "solid")
color |
Character. Color of polygon. |
line.type |
Character. Polygon line type. |
Adds a polygon to a graphics plot.
In progress.
snowMap(add.landmarks = FALSE) addPlaguePit()
snowMap(add.landmarks = FALSE) addPlaguePit()
Add selected pump(s) to plot.
addPump(pump.select = NULL, vestry = FALSE, col = NULL, pch = 24, label = TRUE, pos = 1, cex = 1, latlong = FALSE)
addPump(pump.select = NULL, vestry = FALSE, col = NULL, pch = 24, label = TRUE, pos = 1, cex = 1, latlong = FALSE)
pump.select |
Numeric or Integer. Vector of water pump numerical ID(s). With |
vestry |
Logical. |
col |
Character. Color of pump points. |
pch |
Numeric. Shape of point character. |
label |
Logical. TRUE adds text label. |
pos |
Numeric. Position of label. |
cex |
Numeric. point cex. |
latlong |
Logical. Use c("lon". "lat") or c("x", "y"). |
Add all streets and roads to plot.
addRoads(latlong = FALSE, col = "gray")
addRoads(latlong = FALSE, col = "gray")
latlong |
Logical. Use estimated longitude and latitude. |
col |
Character. Color |
Adds Snow's graphical annotation of the Broad Street pump walking neighborhood.
addSnow(latlong = FALSE, type = "area", color = "dodgerblue", alpha.level = 0.25, line.width = 2)
addSnow(latlong = FALSE, type = "area", color = "dodgerblue", alpha.level = 0.25, line.width = 2)
latlong |
Logical. |
type |
Character. Type of annotation plot: "area" or "perimeter". |
color |
Character. Neighborhood color. |
alpha.level |
Numeric. Alpha level transparency: a value in [0, 1] when type = "area". |
line.width |
Numeric. Line width for |
## Not run: plot(neighborhoodVoronoi()) addSnow() ## End(Not run)
## Not run: plot(neighborhoodVoronoi()) addSnow() ## End(Not run)
Add Voronoi cells.
addVoronoi(pump.select = NULL, vestry = FALSE, case.location = "nominal", color = "black", line.type = "solid", line.width = 1, latlong = FALSE)
addVoronoi(pump.select = NULL, vestry = FALSE, case.location = "nominal", color = "black", line.type = "solid", line.width = 1, latlong = FALSE)
pump.select |
Numeric. Default is NULL; all pumps are used. Otherwise, selection by a vector of numeric IDs: 1 to 13 for |
vestry |
Logical. |
case.location |
Character. For |
color |
Character. Color of cell edges. |
line.type |
Character. Type of line for cell edges: lty. |
line.width |
Numeric. Width of cell edges: lwd. |
latlong |
Logical. Use estimated longitude and latitude. |
This function uses deldir::deldir()
.
snowMap() # addVoronoi()
snowMap() # addVoronoi()
Add walking path from case/landmark to nearest or selected pump. (prototype)
addWalkingPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
addWalkingPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
origin |
Numeric. Vector of origin(s) (numeric or case/landmark name). |
destination |
Numeric. Vector of destination(s) (numeric or landmark/pump name). |
type |
Character. Path case to pump. FALSE is all other combinations of cases, landmarks and pumps. |
vestry |
Logical. |
latlong |
Logical. |
case.set |
Character. "observed" or "expected". |
location |
Character. For cases and pumps. "anchor, "fatality" or "orthogonal. |
weighted |
Logical. |
distance.unit |
Character. Unit of distance: "meter" or "yard". |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
include.landmarks |
Logical. Include landmarks as cases. |
mileposts |
Logical. Plot mile/time posts. |
milepost.unit |
Character. "distance" or "time". |
milepost.interval |
Numeric. Mile post interval unit of distance (yard or meter) or unit of time (seconds). |
alpha.level |
Numeric. Alpha level transparency for path: a value in [0, 1]. |
... |
Additional plotting parameters. |
A circle (polygon), centered around a desired pump with a radius of 210 yards. The Broad Street pump is the default.
addWhitehead(pump = "Broad Street", radius = 210, distance.unit = "yard", color = "black", line.type = "solid", vestry = FALSE, add.subtitle = FALSE, walking.speed = 5)
addWhitehead(pump = "Broad Street", radius = 210, distance.unit = "yard", color = "black", line.type = "solid", vestry = FALSE, add.subtitle = FALSE, walking.speed = 5)
pump |
Character or Numeric. Name (road name) or numerical ID of selected pump. See |
radius |
Numeric. Distance from a pump. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
color |
Character. Color of circle. |
line.type |
Character. Circle line type. |
vestry |
Logical. |
add.subtitle |
Logical. Add subtitle with estimated "walking" time in seconds. |
walking.speed |
Numeric. Walking speed in km/hr. |
Adds a circle (polygon) to a graphics plot.
snowMap(add.landmarks = FALSE) addWhitehead()
snowMap(add.landmarks = FALSE) addWhitehead()
Data frame that links a fatality to its stack, a stack's base case. For use with caseLocator
.
anchor.case
anchor.case
case
numerical case ID
anchor
numerical case ID of anchor.case
unstackFatalities
documents the code for these data.
Vector of ordered numbers that identify the line segments that make up the frame of the map. For use with sp::Polygon().
border
border
border
numerical ID
Compute distance between case fatalities (meters).
caseDistance(a = 19, b = 263, latlong = FALSE)
caseDistance(a = 19, b = 263, latlong = FALSE)
a |
Numeric. Case ID. |
b |
Numeric. Case ID. |
latlong |
Logical. |
Highlight selected observed or simulated case and its home road segment.
caseLocator(case = 1, zoom = FALSE, observed = TRUE, latlong = FALSE, add.title = TRUE, highlight.segment = TRUE, data = FALSE, add = FALSE, col = "red", vestry = FALSE)
caseLocator(case = 1, zoom = FALSE, observed = TRUE, latlong = FALSE, add.title = TRUE, highlight.segment = TRUE, data = FALSE, add = FALSE, col = "red", vestry = FALSE)
case |
Numeric or Integer. Whole number between 1 and 578. |
zoom |
Logical or Numeric.A numeric value >= 0 controls the degree of zoom. The default is 1. |
observed |
Logical. |
latlong |
Logical. Longitude and latitude coordinates |
add.title |
Logical. Include title. |
highlight.segment |
Logical. Highlight case's segment. |
data |
Logical. Output data. |
add |
Logical. Add to existing plot or separate plot. |
col |
Character. Point color. |
vestry |
Logical. |
A base R graphics plot.
caseLocator(290) caseLocator(290, zoom = TRUE) caseLocator(290, observed = FALSE) caseLocator(290, latlong = TRUE, zoom = TRUE)
caseLocator(290) caseLocator(290, zoom = TRUE) caseLocator(290, observed = FALSE) caseLocator(290, latlong = TRUE, zoom = TRUE)
Compute Euclidean path coordinates from observed case/landmark to nearest/selected pump.
euclideanPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE)
euclideanPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE)
origin |
Numeric. Vector of origin(s) (numeric ID or character name landmark/pump ). |
destination |
Numeric. Vector of destination(s) (numeric or landmark/pump name). |
type |
Character. Path case to pump. FALSE is all other combinations of cases, landmarks and pumps. |
vestry |
Logical. |
latlong |
Logical. |
case.set |
Character. "observed" or "expected". |
location |
Character. For cases and pumps. "nominal", "anchor" or "orthogonal". |
weighted |
Logical. |
distance.unit |
Character. Unit of distance: "meter" or "yard". |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
include.landmarks |
Logical. Include landmarks as cases. |
An amended version of Dodson and Tobler's digitization of John Snow's map of the 1854 London cholera outbreak. It removes 3 duplicate observations and imputes the location for 3 "missing" observation. This information is also available in HistData::Snow.deaths2 (>= ver. 0.7-8).
fatalities
fatalities
A data frame with 3 variable that records the position and the nearest pump for the 578 bars on Snow's map.
case
numeric case ID
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
fixFatalities
documents the code for these data. For details, see vignette
("duplicate.missing.cases").
An "unstacked" version of the fatalities
dataset. It changes the unit of observation from the case (bar) to the "address", the x-y coordinates of the case at the base of a stack, and makes the number of fatalities an attribute of the "address".
fatalities.address
fatalities.address
A data frame with 4 variables for 321 addresses
anchor
numerical case ID of address
x
x-coordinate
y
y-coordinate
case.count
number of fatalities at address
lon
longitude
lat
latitude
unstackFatalities
documents the code for these data. For details, see vignette
("unstacking.fatalities").
An "unstacked" version of the fatalities
dataset. It changes the unit of observation from the case (bar) to the "address", the x-y coordinates of the case at the base of a stack, and assigns the base case's coordinates to all cases in the stack.
fatalities.unstacked
fatalities.unstacked
A data frame with 3 variable that records the position of the 578 bars on Snow's map.
case
numerical case ID
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
unstackFatalities
documents the code for these data. For details, see vignette
("unstacking.fatalities").
Fixes two apparent coding errors using three misplaced cases.
fixFatalities()
fixFatalities()
An R data frame.
vignette("duplicate.missing.cases")
Map frame data c("x", "y") and c("lon", "lat").
frame.data
frame.data
A data frame with 106 observations (points) and 8 variables.
street
street number
n
street street component number
x
native x-coordinate
y
native y-coordinate
id
segment numeric ID
name
street name
lon
longitude
lat
latitude
Partitioned map frame points (segment endpoints).
frame.sample
frame.sample
A list of 3 vectors length 19, 19 and 18 from cholera::roads$id.
frame.sample
cholera::roads$id
Centers of city squares.
landmark.squares
landmark.squares
A data frame with 6 variables that records the position of the orthogonal projection of landmarks onto the network of roads.
name
square name
x
x-coordinate
y
y-coordinate
case
numeric case ID
Centers of city squares.
landmark.squaresB
landmark.squaresB
A data frame with 2 observations and 6 variables that records the position of landmark square labels.
case
numeric case ID
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
name
square name
Nominal and orthogonal coordinates
landmarkData(multi.core = TRUE, dev.mode = FALSE)
landmarkData(multi.core = TRUE, dev.mode = FALSE)
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
Orthogonal projection of landmarks onto road network.
landmarks
landmarks
A data frame with 12 variables that records the position of the orthogonal projection of landmarks onto the network of roads.
road.segment
"address" road segment
x.proj
orthogonal x-coordinate
y.proj
orthogonal y-coordinate
ortho.dist
orthogonal distance to home road segment
x
nominal x-coordinate
y
nominal y-coordinate
name
landmark name
case
numeric case ID
lon
longitude
lat
latitude
lon.proj
orthogonal longitude
lat.proj
orthogonal latitude
landmarkData
document the code for these data.
Landmark coordinates.
landmarksB
landmarksB
A data frame of landmark coordinates with 20 observationas and 11 variables.
case
numeric case ID
road.segment
"address" road segment
x
nominal x-coordinate
y
nominal y-coordinate
x.lab
label x-coordinate
y.lab
label y-coordinate
lon
longitude
lat
latitude
lon.lab
label longitude
lat.lab
label latitude
name
landmark name
landmarkData
document the code for these data.
Orthogonal projection of observed address (latlong) cases onto road network.
latlong.ortho.addr
latlong.ortho.addr
A data frame with 7 variables that records the position of the orthogonal projection of the 321 cases onto the network of roads.
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
case
numeric case ID
lon
longitude
lat
latitude
unstackFatalities
documents the code for these data.
Orthogonal projection of 13 original pumps (latlong).
latlong.ortho.pump
latlong.ortho.pump
A data frame with 7 variables that records the position of the orthogonal projection of the 13 original pumps onto the network of roads.
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
id
numeric ID
lon
longitude
lat
latitude
pumpData
documents the code for these data.
Orthogonal projection of the 14 pumps from the Vestry Report (latlong).
latlong.ortho.pump.vestry
latlong.ortho.pump.vestry
A data frame with 7 variables that records the position of the orthogonal projection of the 14 pumps onto the network of roads.
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
id
numeric ID
lon
longitude
lat
latitude
pumpData
documents the code for these data.
The result of using sp::spsample() and sp::Polygon() to generate 19,993 regularly spaced simulated Cartesian/geodesic cases within the map's borders.
latlong.regular.cases
latlong.regular.cases
A data frame with 4 variables that records the position of 19,993 "expected" cases fitted by sp::spsample().
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
Road "address" of simulated (i.e., "expected") cases (latlong).
latlong.sim.ortho.proj
latlong.sim.ortho.proj
A data frame with 8 variables that records the "address" of 19,993 regularly spaced simulated Cartesian/geodesic cases regularly spaced across map.
case
numeric case ID
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
dist
Euclidean or orthogonal distance to home road segment
type
type of projection: Euclidean ("eucl") or orthogonal ("ortho")
lon
longitude
lat
latitude
Compute xlim and ylim of Snow's map.
mapRange(latlong = FALSE)
mapRange(latlong = FALSE)
latlong |
Logical. Use estimated longitude and latitude. |
Compute shortest distances to selected pumps.
nearestPump(pump.select = NULL, metric = "walking", vestry = FALSE, weighted = TRUE, case.set = "observed", latlong = FALSE, multi.core = TRUE, dev.mode = FALSE)
nearestPump(pump.select = NULL, metric = "walking", vestry = FALSE, weighted = TRUE, case.set = "observed", latlong = FALSE, multi.core = TRUE, dev.mode = FALSE)
pump.select |
Numeric. Pump candidates to consider. Default is |
metric |
Character. "euclidean" or "walking". |
vestry |
Logical. |
weighted |
Logical. |
case.set |
Character. "observed" or "expected" # or "snow". |
latlong |
Logical. |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
Assembles cases, pumps and road into a network graph.
neighborhoodData(vestry = FALSE, case.set = "observed", embed = TRUE, embed.landmarks = TRUE)
neighborhoodData(vestry = FALSE, case.set = "observed", embed = TRUE, embed.landmarks = TRUE)
vestry |
Logical. Use Vestry Report pump data. |
case.set |
Character. "observed", "expected", or "snow". "snow" captures John Snow's annotation of the Broad Street pump neighborhood printed in the Vestry report version of the map. |
embed |
Logical. Embed cases and pumps into road network. |
embed.landmarks |
Logical. Embed landmarks into road network. |
An R list of nodes, edges and an 'igraph' network graph.
Assembles cases, pumps and road into a network graph.
neighborhoodDataB(vestry = FALSE, case.set = "observed", embed.addr = TRUE, embed.landmarks = TRUE, embed.pumps = TRUE, latlong = FALSE)
neighborhoodDataB(vestry = FALSE, case.set = "observed", embed.addr = TRUE, embed.landmarks = TRUE, embed.pumps = TRUE, latlong = FALSE)
vestry |
Logical. Use Vestry Report pump data. |
case.set |
Character. "observed", "expected", or "snow". "snow" captures John Snow's annotation of the Broad Street pump neighborhood printed in the Vestry report version of the map. |
embed.addr |
Logical. Embed cases into road network. |
embed.landmarks |
Logical. Embed landmarks into road network. |
embed.pumps |
Logical. Embed pumps into road network. |
latlong |
Logical. Use estimated longitude and latitude. |
An R list of nodes, edges and an 'igraph' network graph.
Plots star graph from pump to its cases.
neighborhoodEuclidean(pump.select = NULL, vestry = FALSE, case.set = "observed", case.select = "address", latlong = FALSE, location = "nominal", brute.force = FALSE, multi.core = TRUE, dev.mode = FALSE)
neighborhoodEuclidean(pump.select = NULL, vestry = FALSE, case.set = "observed", case.select = "address", latlong = FALSE, location = "nominal", brute.force = FALSE, multi.core = TRUE, dev.mode = FALSE)
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
vestry |
Logical. |
case.set |
Character. "observed" or "expected". |
case.select |
Character. Fatalities: "all" or "address". |
latlong |
Logical. Longitude and latitude coordinates |
location |
Character. "nominal", "anchor" or "orthogonal". |
brute.force |
Logical. For latlong = FALSE. TRUE computes nearest pump for each case. FALSE uses Voronoi cells as shortcut. |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
An R list.
Group cases into neighborhoods using Voronoi tessellation.
neighborhoodVoronoi(pump.select = NULL, vestry = FALSE, latlong = FALSE, location = "nominal", polygon.vertices = FALSE)
neighborhoodVoronoi(pump.select = NULL, vestry = FALSE, latlong = FALSE, location = "nominal", polygon.vertices = FALSE)
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
vestry |
Logical. |
latlong |
Logical. Longitude and latitude coordinates |
location |
Character. "nominal" or "orthogonal". "nominal" uses the x-y coordinates of |
polygon.vertices |
Logical. |
An R list with 12 objects.
pump.id
: vector of selected pumps
voronoi
: output from deldir::deldir().
snow.colors
: neighborhood color based on snowColors().
x.rng
: range of x for plot.
y.rng
: range of y for plot.
select.string
: description of "pump.select" for plot title.
expected.data
: expected neighborhood fatality counts, based on Voronoi cell area.
coordinates
: polygon vertices of Voronoi cells.
statistic.data
: observed neighborhood fatality counts.
pump.select
: "pump.select" from neighborhoodVoronoi().
statistic
: "statistic" from neighborhoodVoronoi().
vestry
: "vestry" from neighborhoodVoronoi().
## Not run: neighborhoodVoronoi() neighborhoodVoronoi(vestry = TRUE) neighborhoodVoronoi(pump.select = 6:7) neighborhoodVoronoi(pump.select = -6) neighborhoodVoronoi(pump.select = -6, polygon.vertices = TRUE) # coordinates for vertices also available in the returned object. dat <- neighborhoodVoronoi(pump.select = -6) dat$coordinates ## End(Not run)
## Not run: neighborhoodVoronoi() neighborhoodVoronoi(vestry = TRUE) neighborhoodVoronoi(pump.select = 6:7) neighborhoodVoronoi(pump.select = -6) neighborhoodVoronoi(pump.select = -6, polygon.vertices = TRUE) # coordinates for vertices also available in the returned object. dat <- neighborhoodVoronoi(pump.select = -6) dat$coordinates ## End(Not run)
Group cases into neighborhoods based on walking distance.
neighborhoodWalking(pump.select = NULL, vestry = FALSE, weighted = TRUE, case.set = "observed", multi.core = TRUE, dev.mode = FALSE, latlong = FALSE)
neighborhoodWalking(pump.select = NULL, vestry = FALSE, weighted = TRUE, case.set = "observed", multi.core = TRUE, dev.mode = FALSE, latlong = FALSE)
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
vestry |
Logical. |
weighted |
Logical. |
case.set |
Character. "observed", "expected" or "snow". "snow" captures John Snow's annotation of the Broad Street pump neighborhood printed in the Vestry report version of the map. |
multi.core |
Logical or Numeric. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
latlong |
Logical. |
## Not run: neighborhoodWalking() neighborhoodWalking(pump.select = -6) ## End(Not run)
## Not run: neighborhoodWalking() neighborhoodWalking(pump.select = -6) ## End(Not run)
Orthogonal projection of observed cases onto road network.
ortho.proj
ortho.proj
A data frame with 5 variables that records the position of the orthogonal projection of the 578 cases onto the network of roads.
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
case
numeric case ID
unstackFatalities
documents the code for these data.
Orthogonal projection of 13 original pumps.
ortho.proj.pump
ortho.proj.pump
A data frame with 6 variables that records the position of the orthogonal projection of the 13 original pumps onto the network of roads.
pump.id
numeric ID
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
node
node ID
pumpData
documents the code for these data.
Orthogonal projection of the 14 pumps from the Vestry Report.
ortho.proj.pump.vestry
ortho.proj.pump.vestry
A data frame with 6 variables that records the position of the orthogonal projection of the 14 pumps onto the network of roads.
pump.id
numeric ID
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
ortho.dist
orthogonal distance to home road segment
node
node ID
pumpData
documents the code for these data.
Extract from UK Met Office (https://www.metoffice.gov.uk/pub/data/weather/uk/climate/stationdata/oxforddata.txt): Lat 51.761 Lon -1.262, 63 metres amsl. Approximate 90 km (55 miles) northwest of Soho.
oxford.weather
oxford.weather
A data frame with 9 variables and 2054 observations.
year
Year
month
Month
tmax
Mean daily maximum temperature Celsius
tmin
Mean daily minimum temperature Celsius
af
Days of air frost
rain
Total rainfall (mm)
sun
Total sunshine duration hours
prov
Provisional data
date
Date
Add and use last day of month as unit of observation to oxford.weather.
oxfordWeather()
oxfordWeather()
An R data frame.
December 1860 observation is dropped due to missing "tmin" value.
Compute Pearson Residuals (prototype)
pearsonResiduals(x)
pearsonResiduals(x)
x |
An object created by |
An R vector.
## Not run: pearsonResiduals(neighborhoodEuclidean()) pearsonResiduals(neighborhoodVoronoi()) pearsonResiduals(neighborhoodWalking()) ## End(Not run)
## Not run: pearsonResiduals(neighborhoodEuclidean()) pearsonResiduals(neighborhoodVoronoi()) pearsonResiduals(neighborhoodWalking()) ## End(Not run)
Coordinates for polygon() or sp::Polygon(). In progress.
plague.pit
plague.pit
A data frame with 13 observations and 2 variables.
x
x-coordinate
y
y-coordinate
Plot method for neighborhoodEuclidean().
## S3 method for class 'euclidean' plot(x, type = "star", add.observed.points = TRUE, add.title = TRUE, ...)
## S3 method for class 'euclidean' plot(x, type = "star", add.observed.points = TRUE, add.title = TRUE, ...)
x |
An object of class "euclidean" created by |
type |
Character. "star", "area.points" or "area.polygons". "area" flavors only valid when |
add.observed.points |
Logical. Add observed fatality "addresses". |
add.title |
Logical. Add title. |
... |
Additional plotting parameters. |
A base R plot.
This uses an approximate computation of polygons, using the 'TSP' package, that may produce non-simple and/or overlapping polygons.
## Not run: plot(neighborhoodEuclidean()) plot(neighborhoodEuclidean(-6)) plot(neighborhoodEuclidean(pump.select = 6:7)) plot(neighborhoodEuclidean(case.set = "expected"), type = "area.points") plot(neighborhoodEuclidean(case.set = "expected"), type = "area.polygons") ## End(Not run)
## Not run: plot(neighborhoodEuclidean()) plot(neighborhoodEuclidean(-6)) plot(neighborhoodEuclidean(pump.select = 6:7)) plot(neighborhoodEuclidean(case.set = "expected"), type = "area.points") plot(neighborhoodEuclidean(case.set = "expected"), type = "area.polygons") ## End(Not run)
Plot the path of the Euclidean distance between cases and/or pumps.
## S3 method for class 'euclidean_path' plot(x, zoom = TRUE, long.title = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
## S3 method for class 'euclidean_path' plot(x, zoom = TRUE, long.title = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
x |
An object of class "euclidean_path" created by euclideanPath(). |
zoom |
Logical or Numeric. A numeric value >= 0 controls the degree of zoom. The default is 0.5. |
long.title |
Logical. Tile with names. |
mileposts |
Logical. Plot mile/time posts. |
milepost.unit |
Character. "distance" or "time". |
milepost.interval |
Numeric. Mile post interval unit of distance (yard or meter) or unit of time (seconds). |
alpha.level |
Numeric. Alpha level transparency for path: a value in [0, 1]. |
... |
Additional plotting parameters. |
A base R plot.
Plot method for euclideanLatlong()
## S3 method for class 'euclideanLatlong' plot(x, type = "star", ...)
## S3 method for class 'euclideanLatlong' plot(x, type = "star", ...)
x |
Object. |
type |
Character. "star", "area.points" or "area.polygons". "area" flavors only valid when |
... |
Additional plotting parameters. |
Visualize underlying road network (with or without cases and pumps).
## S3 method for class 'neighborhood_data' plot(x, ...)
## S3 method for class 'neighborhood_data' plot(x, ...)
x |
An 'igraph' object of class "neighborhood_data" created by |
... |
Additional plotting parameters. |
A base R plot.
plot(neighborhoodData()) plot(neighborhoodData(embed = FALSE))
plot(neighborhoodData()) plot(neighborhoodData(embed = FALSE))
Plot method for oxfordWeather().
## S3 method for class 'oxfordWeather' plot(x, statistic = "temperature", month = "september", end.year = NULL, unit.observation = "month", ...)
## S3 method for class 'oxfordWeather' plot(x, statistic = "temperature", month = "september", end.year = NULL, unit.observation = "month", ...)
x |
object. |
statistic |
Character. |
month |
Character. "august" or "september". |
end.year |
Numeric. |
unit.observation |
Character. "day" or "month". |
... |
Additional plotting parameters. |
A base R plot.
Plot method for povertyLondon().
## S3 method for class 'povertyLondon' plot(x, district = c("City", "Westminster", "Marylebone", "St. Giles"), ...)
## S3 method for class 'povertyLondon' plot(x, district = c("City", "Westminster", "Marylebone", "St. Giles"), ...)
x |
object. |
district |
Character. Selected district(s). |
... |
Additional plotting parameters. |
Plot method for profilePerspective().
## S3 method for class 'profile_perspective' plot(x, ...)
## S3 method for class 'profile_perspective' plot(x, ...)
x |
An object of class "profile" created by |
... |
Additional plotting parameters. |
Plot aggregate fatality data and indicates the date of the removal of the handle of the Broad Street pump.
## S3 method for class 'time_series' plot(x, statistic = "fatal.attacks", pump.handle = TRUE, main = "Removal of the Broad Street Pump Handle", type = "o", xlab = "Date", ylab = "Fatalities", ...)
## S3 method for class 'time_series' plot(x, statistic = "fatal.attacks", pump.handle = TRUE, main = "Removal of the Broad Street Pump Handle", type = "o", xlab = "Date", ylab = "Fatalities", ...)
x |
An object of class "time_series" from timeSeries(). |
statistic |
Character. Fatality measure: either "fatal.attacks" or "deaths". |
pump.handle |
Logical. Indicate date of removal of Broad Street pump handle. |
main |
Character. Title of graph. |
type |
Character. R plot type. |
xlab |
Character. x-axis label. |
ylab |
Character. y-axis label. |
... |
Additional plotting parameters. |
plot(timeSeries()) plot(timeSeries(), statistic = "deaths") plot(timeSeries(), bty = "n", type = "h", lwd = 4)
plot(timeSeries()) plot(timeSeries(), statistic = "deaths") plot(timeSeries(), bty = "n", type = "h", lwd = 4)
Plot Voronoi neighborhoods.
## S3 method for class 'voronoi' plot(x, delaunay.voronoi = "voronoi", euclidean.paths = FALSE, ...)
## S3 method for class 'voronoi' plot(x, delaunay.voronoi = "voronoi", euclidean.paths = FALSE, ...)
x |
An object of class "voronoi" created by |
delaunay.voronoi |
Character "delaunay", "voronoi", or "both". |
euclidean.paths |
Logical. Plot all Euclidean paths (star graph). |
... |
Additional plotting parameters. |
A base R graph.
voronoiNominal()
addVoronoi()
Plot method for voronoiLatlong()
## S3 method for class 'voronoiLatlong' plot(x, add.pumps = TRUE, delaunay.voronoi = "voronoi", euclidean.paths = FALSE, ...)
## S3 method for class 'voronoiLatlong' plot(x, add.pumps = TRUE, delaunay.voronoi = "voronoi", euclidean.paths = FALSE, ...)
x |
Object. |
add.pumps |
Logical. |
delaunay.voronoi |
Character "delaunay", "voronoi", or "both". |
euclidean.paths |
Logical. |
... |
Additional plotting parameters. |
Plot method for walkingNominal().
## S3 method for class 'walking' plot(x, type = "roads", tsp.method = "repetitive_nn", ...)
## S3 method for class 'walking' plot(x, type = "roads", tsp.method = "repetitive_nn", ...)
x |
An object of class "walking" created by |
type |
Character. "roads", "area.points" or "area.polygons". "area" flavors only valid when |
tsp.method |
Character. Traveling salesperson problem algorithm. |
... |
Additional plotting parameters. |
A base R plot.
When plotting area graphs with simulated data (i.e., case.set = "expected"
), there may be discrepancies between observed cases and expected neighborhoods, particularly between neighborhoods. type = "roads" inspired by Shiode et. al. (2015).
Plot the walking path between selected cases and/or pumps.
## S3 method for class 'walking_path' plot(x, zoom = TRUE, long.title = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
## S3 method for class 'walking_path' plot(x, zoom = TRUE, long.title = TRUE, mileposts = TRUE, milepost.unit = "distance", milepost.interval = NULL, alpha.level = 1, ...)
x |
An object of class "walking_path" created by walkingPath(). |
zoom |
Logical or Numeric. A numeric value >= 0 controls the degree of zoom. A value of 1 equals zoom = TRUE. |
long.title |
Logical. Tile with names. |
mileposts |
Logical. Plot mile/time posts. |
milepost.unit |
Character. "distance" or "time". |
milepost.interval |
Numeric. Mile post interval unit of distance (yard or meter) or unit of time (seconds). |
alpha.level |
Numeric. Alpha level transparency for path: a value in [0, 1]. |
... |
Additional plotting parameters. |
A base R plot.
Plot method for walkingB().
## S3 method for class 'walkingB' plot(x, type = "area.points", tsp.method = "repetitive_nn", ...)
## S3 method for class 'walkingB' plot(x, type = "area.points", tsp.method = "repetitive_nn", ...)
x |
An object of class "walking" created by |
type |
Character. "roads", "area.points" or "area.polygons". "area" flavors only valid when |
tsp.method |
Character. Traveling salesperson problem algorithm. |
... |
Additional plotting parameters. |
A base R plot.
When plotting area graphs with simulated data (i.e., case.set = "expected"
), there may be discrepancies between observed cases and expected neighborhoods, particularly between neighborhoods. type = "roads" inspired by Shiode et. al. (2015).
Plot method for walkingLatlong().
## S3 method for class 'walkingLatlong' plot(x, type = "roads", ...)
## S3 method for class 'walkingLatlong' plot(x, type = "roads", ...)
x |
An object of class "latlong_walking" created by |
type |
Character. "area.points", "area.polygons" or "roads". For walkingLatlong(case.set = "expected"). |
... |
Additional plotting parameters. |
A base R plot.
Plot method for winterTemperatures().
## S3 method for class 'winterTemperatures' plot(x, end.date = "1859-6-1", ...)
## S3 method for class 'winterTemperatures' plot(x, end.date = "1859-6-1", ...)
x |
object. |
end.date |
Date. "yyyy-mm-dd" or NULL. |
... |
Additional plotting parameters. |
A base R plot.
plot(winterTemperatures())
plot(winterTemperatures())
Gareth Stedman Jones, p. 132. Census and Charles Booth Data, 1881.
povertyLondon()
povertyLondon()
Parameter values for neighborhoodEuclidean().
## S3 method for class 'euclidean' print(x, ...)
## S3 method for class 'euclidean' print(x, ...)
x |
An object of class "euclidean" created by |
... |
Additional parameters. |
A list of argument values.
## Not run: neighborhoodEuclidean() print(neighborhoodEuclidean()) ## End(Not run)
## Not run: neighborhoodEuclidean() print(neighborhoodEuclidean()) ## End(Not run)
Summary output.
## S3 method for class 'euclidean_path' print(x, ...)
## S3 method for class 'euclidean_path' print(x, ...)
x |
An object of class "euclidean_path" created by |
... |
Additional parameters. |
An R data frame.
Return summary results.
## S3 method for class 'time_series' print(x, ...)
## S3 method for class 'time_series' print(x, ...)
x |
An object of class "time_series" created by timeSeries(). |
... |
Additional parameters. |
An R data frame.
timeSeries() print(timeSeries())
timeSeries() print(timeSeries())
Parameter values for voronoiNominal().
## S3 method for class 'voronoi' print(x, ...)
## S3 method for class 'voronoi' print(x, ...)
x |
An object of class "voronoi" created by |
... |
Additional arguments. |
A list of argument values.
Parameter values for voronoiLatlong().
## S3 method for class 'voronoiLatlong' print(x, ...)
## S3 method for class 'voronoiLatlong' print(x, ...)
x |
An object of class "voronoiLatlong" created by |
... |
Additional arguments. |
A list of argument values.
Parameter values for neighborhoodWalking().
## S3 method for class 'walking' print(x, ...)
## S3 method for class 'walking' print(x, ...)
x |
An object of class "walking" created by |
... |
Additional parameters. |
A list of argument values.
Summary output.
## S3 method for class 'walking_path' print(x, ...)
## S3 method for class 'walking_path' print(x, ...)
x |
An object of class "latlong_walking_path" created by latlongWalkingPath(). |
... |
Additional parameters. |
An R data frame.
2D Profile .
profile2D(angle = 0, pump = 7, vestry = FALSE, graphics = "base", multi.core = FALSE)
profile2D(angle = 0, pump = 7, vestry = FALSE, graphics = "base", multi.core = FALSE)
angle |
Numeric. Angle of perspective axis in degrees. |
pump |
Numeric. Select pump as focal point. |
vestry |
Logical. |
graphics |
Character. Type of graphic: "base" or "ggplot2". |
multi.core |
Logical or Numeric. |
## Not run: profile2D(angle = 30) profile2D(angle = 30, graphics = "ggplot2") ## End(Not run)
## Not run: profile2D(angle = 30) profile2D(angle = 30, graphics = "ggplot2") ## End(Not run)
3D Profile.
profile3D(pump.select = NULL, pump.subset = NULL, vestry = FALSE, drop.neg.subset = FALSE, multi.core = TRUE)
profile3D(pump.select = NULL, pump.subset = NULL, vestry = FALSE, drop.neg.subset = FALSE, multi.core = TRUE)
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
pump.subset |
Numeric. Vector of numeric pump IDs to subset from the neighborhoods defined by |
vestry |
Logical. |
drop.neg.subset |
Logical. Drop negative subset selection |
multi.core |
Logical or Numeric. |
## Not run: profile3D(pump.select = 6:7) profile3D(pump.subset = -7) profile3D(pump.subset = -7, drop.neg.subset = TRUE) ## End(Not run)
## Not run: profile3D(pump.select = 6:7) profile3D(pump.subset = -7) profile3D(pump.subset = -7, drop.neg.subset = TRUE) ## End(Not run)
Extract numeric case IDs by pump neighborhood.
pumpCase(x, case)
pumpCase(x, case)
x |
An object created by |
case |
Character. "address" or "fatality" |
An R list of numeric ID of cases by pump neighborhoods.
## Not run: pumpCase(neighborhoodEuclidean()) pumpCase(neighborhoodVoronoi()) pumpCase(neighborhoodWalking()) ## End(Not run)
## Not run: pumpCase(neighborhoodEuclidean()) pumpCase(neighborhoodVoronoi()) pumpCase(neighborhoodWalking()) ## End(Not run)
Returns either the set of x-y coordinates for the pumps themselves or for their orthogonally projected "addresses" on the network of roads.
pumpData(vestry = FALSE, orthogonal = FALSE, multi.core = TRUE)
pumpData(vestry = FALSE, orthogonal = FALSE, multi.core = TRUE)
vestry |
Logical. |
orthogonal |
Logical. |
multi.core |
Logical or Numeric. |
An R data frame.
Note: The location of the fourteenth pump, at Hanover Square, and the "correct" location of the Broad Street pump are approximate. This function documents the code that generates pumps
, pumps.vestry
, ortho.proj.pump
and ortho.proj.pump.vestry
.
Compute fatalities by pump.
pumpFatalities(pump.select = NULL, metric = "walking", vestry = FALSE, latlong = FALSE, multi.core = TRUE)
pumpFatalities(pump.select = NULL, metric = "walking", vestry = FALSE, latlong = FALSE, multi.core = TRUE)
pump.select |
Numeric. Pump candidates to consider. Default is |
metric |
Character. "euclidean" or "walking". |
vestry |
Logical. |
latlong |
Logical. Use estimated longitude and latitude. |
multi.core |
Logical or Numeric. |
## Not run: pumpFatalities(pump.select = -7) pumpFatalities(latlong = TRUE) pumpFatalities(metric = "euclidean", vestry = TRUE) ## End(Not run)
## Not run: pumpFatalities(pump.select = -7) pumpFatalities(latlong = TRUE) pumpFatalities(metric = "euclidean", vestry = TRUE) ## End(Not run)
Highlight selected water pump.
pumpLocator(id = 7, zoom = 1, vestry = FALSE, add.title = TRUE, highlight.segment = TRUE, data = FALSE)
pumpLocator(id = 7, zoom = 1, vestry = FALSE, add.title = TRUE, highlight.segment = TRUE, data = FALSE)
id |
Numeric or Integer. With |
zoom |
Logical or Numeric. A numeric value >= 0 controls the degree of zoom. The default is 1. |
vestry |
Logical. |
add.title |
Logical. Include title. |
highlight.segment |
Logical. Highlight case's segment. |
data |
Logical. Output data. |
A base R graphics plot.
pumpLocator() pumpLocator(zoom = TRUE) pumpLocator(14, vestry = TRUE, zoom = TRUE)
pumpLocator() pumpLocator(zoom = TRUE) pumpLocator(14, vestry = TRUE, zoom = TRUE)
Adds and amends road locations for water pumps from John Snow's map to Dodson and Tobler's street data. The latter are available at Michael Friendly's HistData::Snow.streets.
pumps
pumps
A data frame with 13 observations and 4 variables that describe the pumps on Snow's map.
id
pump number between 1 and 13
street
nearest street
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
pumpData
documents the code for these data.
These data include the fourteenth pump, at Hanover Square, and the "corrected" location of the Broad Street pump that Snow includes in the second version of his map in the Vestry report.
pumps.vestry
pumps.vestry
A data frame with 14 observations and 4 variables.
id
pump number between 1 and 14
street
nearest street
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
pumpData
documents the code for these data.
Sample of road intersections (segment endpoints).
rd.sample
rd.sample
A list with 2 variables that list randomly re-arranges unique road intersections (segment endpoints).
one
endpoints with 1 intersection
three
endpoints with 3 intersections
Coordinates to filter out frame shadow using sp::point.in.polygon().
rectangle.filter
rectangle.filter
A data frame with 2 variables and 4 observations.
x
longitude
y
latitude
The result of using sp::spsample() and sp::Polygon() to generate 19,993 regularly spaced simulated cases within the map's borders.
regular.cases
regular.cases
A data frame with 2 variable that records the position of 19,993 "expected" cases fitted by sp::spsample().
x
x-coordinate
y
y-coordinate
simulateFatalities
documents the code for these data.
This data set transforms Dodson and Tobler's street data to give each straight line segment of a "road" a unique ID.
road.segments
road.segments
A data frame with 658 observations and 7 variables. The data describe the straight line segments used to recreate the roads on Snow's map.
street
numeric street ID, which range between 1 and 528
id
character segment ID
name
road name
x1
x-coordinate of first endpoint
y1
y-coordinate of first endpoint
x2
x-coordinate of second endpoint
y2
y-coordinate of second endpoint
roadSegments
documents the code for these data.
vignette
("road.names")
This data set adds road names from John Snow's map to Dodson and Tobler's street data. The latter are also available from HistData::Snow.streets.
roads
roads
A data frame with 1243 observations and 6 variables. The data describe the roads on Snow's map.
street
street segment number, which range between 1 and 528
n
number of points in this street line segment
x
x-coordinate
y
y-coordinate
id
unique numeric ID
name
road name
lon
longitude
lat
latitude
vignette
("road.names")
Used to integrate pumps and cases into road network when computing walking neighborhoods.
roadSegments(latlong = FALSE)
roadSegments(latlong = FALSE)
latlong |
Logical. Use estimated longitude and latitude. |
An R data frame.
This function documents the code that generates road.segments
.
Highlight segment by ID.
segmentHighlight(id, highlight = TRUE, col = "red", rotate.label = FALSE, latlong = FALSE)
segmentHighlight(id, highlight = TRUE, col = "red", rotate.label = FALSE, latlong = FALSE)
id |
Character. Segment ID: a concatenation of a street's numeric ID, a whole number between 1 and 528, and a second number to identify the segment. |
highlight |
Logical. Color segment. |
col |
Character. Highlight color. |
rotate.label |
Logical. Rotate segment ID label. |
latlong |
Logical. Use estimated longitude and latitude. |
A base R graphics segment(s).
streetNameLocator("Soho Square", zoom = TRUE, highlight = FALSE) ids <- road.segments[road.segments$name == "Soho Square", "id"] invisible(lapply(ids, function(x) segmentHighlight(x, highlight = FALSE)))
streetNameLocator("Soho Square", zoom = TRUE, highlight = FALSE) ids <- road.segments[road.segments$name == "Soho Square", "id"] invisible(lapply(ids, function(x) segmentHighlight(x, highlight = FALSE)))
Compute length of road segment.
segmentLength(id = "216-1", distance.unit = "meter", latlong = FALSE)
segmentLength(id = "216-1", distance.unit = "meter", latlong = FALSE)
id |
Character. A concatenation of a street's numeric ID, a whole number between 1 and 528, and a second number used to identify the sub-segments. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
latlong |
Logical. |
An R vector of length one.
segmentLength("242-1") segmentLength("242-1", distance.unit = "yard")
segmentLength("242-1") segmentLength("242-1", distance.unit = "yard")
Highlight selected road segment(s) and cases.
segmentLocator(segment.id = "216-1", zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
segmentLocator(segment.id = "216-1", zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
segment.id |
Character. A vector of segment IDs. See Note. |
zoom |
Logical or Numeric. Positive value zoom in. Negative values zoom out. |
latlong |
Logical. Longitude and latitude coordinates |
cases |
Character. Cases to plot: |
token |
Character. Cases as "id" or "point". |
vestry |
Logical. |
add.pump |
Logical. Include pumps. |
add.title |
Logical. Include title. |
add.subtitle |
Logical. Include subtitle. |
highlight |
Logical. Highlight selected segment(s) and cases. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
cex.text |
Numeric. |
A base R graphics plot.
With Dodson and Tobler's data, a street (e.g., Broad Street) is often comprised of multiple straight line segments. To identify each segment individually, an additional number is appended to form a text string ID (e.g., "116-2"). See cholera::road.segments
.
segmentLocator("216-1") segmentLocator("216-1", zoom = -10) segmentLocator("216-1", latlong = TRUE, zoom = -10) segmentLocator("216-1", distance.unit = "yard") segmentLocator("216-1", zoom = FALSE)
segmentLocator("216-1") segmentLocator("216-1", zoom = -10) segmentLocator("216-1", latlong = TRUE, zoom = -10) segmentLocator("216-1", distance.unit = "yard") segmentLocator("216-1", zoom = FALSE)
Road "address" of simulated (i.e., "expected") cases.
sim.ortho.proj
sim.ortho.proj
A data frame with 6 variables that records the "address" of 19,993 simulate cases along the network of roads.
case
numeric case ID
road.segment
"address" road segment
x.proj
x-coordinate
y.proj
y-coordinate
dist
Euclidean or orthogonal distance to home road segment
type
type of projection: Euclidean ("eucl") or orthogonal ("ortho")
simulateFatalities
documents the code for these data.
List of "simulated" fatalities grouped by walking-distance pump neighborhood.
sim.pump.case
sim.pump.case
A list 4972 IDs spread over 13 vectors.
sim.pump.case
numerical ID
neighborhoodWalking
documents the code for these data. For details, see vignette
("pump.neighborhoods").
## Not run: pumpCase(neighborhoodWalking(case.set = "expected")) ## End(Not run)
## Not run: pumpCase(neighborhoodWalking(case.set = "expected")) ## End(Not run)
Walking distance to Broad Street Pump (#7).
sim.walking.distance
sim.walking.distance
A data frames with 5 variables.
case
case ID
pump
pump ID
pump.name
pump name
distance
walking distance in meters
time
walking time in seconds based on 5 km/hr walking speed
Places regularly spaced "simulated" or "expected" cases across the face of the map and then finds the "addresses" of those cases via orthogonal projection or simple proximity to road graph network. These data are used to generate "expected" pump neighborhoods.
simulateFatalities(recompute.regular.cases = FALSE, simulated.obs = 20000L, multi.core = TRUE)
simulateFatalities(recompute.regular.cases = FALSE, simulated.obs = 20000L, multi.core = TRUE)
recompute.regular.cases |
Logical. |
simulated.obs |
Numeric. Number of regular cases. For use with |
multi.core |
Logical or Numeric. |
An R data frame: sim.ortho.proj
.
This function is computationally intensive. With "simulated.obs" set to 20,000 (generating 19,993 cases). This function documents the code that generates sim.ortho.proj
and regular.cases
. In real world terms, the distance between simulated cases is approximately 6 meters.
Numeric IDs of fatalities from Dodson and Tobler that fall within Snow's Broad Street pump neighborhood.
snow.neighborhood
snow.neighborhood
A vector with 384 observations.
snow.neighborhood
numeric case ID
Uses RColorBrewer::brewer.pal()
.
snowColors(vestry = FALSE)
snowColors(vestry = FALSE)
vestry |
Logical. |
A character vector of colors.
Built with 'RColorBrewer' package.
Plot John Snow's cholera map.
snowMap(vestry = FALSE, stacked = TRUE, add.axes_box = TRUE, add.cases = TRUE, add.landmarks = FALSE, add.pumps = TRUE, add.roads = TRUE, add.frame = TRUE, main = NA, case.col = "gray", case.pch = 15, latlong = FALSE, ...)
snowMap(vestry = FALSE, stacked = TRUE, add.axes_box = TRUE, add.cases = TRUE, add.landmarks = FALSE, add.pumps = TRUE, add.roads = TRUE, add.frame = TRUE, main = NA, case.col = "gray", case.pch = 15, latlong = FALSE, ...)
vestry |
Logical. |
stacked |
Logical. Use stacked fatalities. |
add.axes_box |
Logical. Add plot axes and plot box. |
add.cases |
Logical. Add observed cases. |
add.landmarks |
Logical. Add landmarks. |
add.pumps |
Logical. Add pumps. |
add.roads |
Logical. Add roads. |
add.frame |
Logical. Add map frame. |
main |
Character. Title of graph. |
case.col |
Character. Color of fatalities. |
case.pch |
Character. Color of fatalities. |
latlong |
Logical. Use estimated longitude and latitude. |
... |
Additional plotting parameters. |
A base R graphics plot.
Uses amended version of Dodson and Tobler's data included in this package.
snowMap() snowMap(vestry = TRUE, stacked = FALSE)
snowMap() snowMap(vestry = TRUE, stacked = FALSE)
Computes "missing" and split road segments data, and area plot data.
snowNeighborhood(latlong = FALSE)
snowNeighborhood(latlong = FALSE)
latlong |
Logical. Use estimated longitude and latitude. |
An R list of edge IDs and simulated case IDs.
Highlight road by name.
streetHighlight(road.name, col = "red", lwd = 3, latlong = FALSE)
streetHighlight(road.name, col = "red", lwd = 3, latlong = FALSE)
road.name |
Character vector. The function tries to correct for case and remove extra spaces (includes "Map Frame"). |
col |
Character. Highlight color. |
lwd |
Numeric. Line width. |
latlong |
Logical. Use estimated longitude and latitude. |
A base R graphics segment(s).
snowMap() streetHighlight("Broad Street")
snowMap() streetHighlight("Broad Street")
Compute length of selected street.
streetLength(road = "Oxford Street", distance.unit = "meter", latlong = FALSE)
streetLength(road = "Oxford Street", distance.unit = "meter", latlong = FALSE)
road |
Character or Numeric. Road name or number. For names, the function tries to correct for case and to remove extra spaces. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
latlong |
Logical. Use estimated longitude and latitude. |
An R vector of length one.
streetLength("Oxford Street") streetLength("oxford street") streetLength("oxford street", distance.unit = "yard")
streetLength("Oxford Street") streetLength("oxford street") streetLength("oxford street", distance.unit = "yard")
Highlight selected road(s) and cases.
streetNameLocator(street.name = "Broad Street", zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
streetNameLocator(street.name = "Broad Street", zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
street.name |
Character. A street name or vector of street names (e.g., "Broad Street", "Poland Street"). |
zoom |
Logical or Numeric. Positive values zoom in. Negative values zoom out. |
latlong |
Logical. Longitude and latitude coordinates |
cases |
Character. Cases to plot: |
token |
Character. Cases as "id" or "point". |
vestry |
Logical. |
add.pump |
Logical. Include pumps. |
add.title |
Logical. Include title. |
add.subtitle |
Logical. Include subtitle. |
highlight |
Logical. Highlight selected segment(s) and cases. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
cex.text |
Numeric. |
A base R graphics plot.
See streetNames()
.
streetNameLocator("broad street") streetNameLocator("Broad Street", zoom = -10) streetNameLocator("Broad Street", latlong = TRUE, zoom = -10) streetNameLocator("Broad Street", distance.unit = "yard") streetNameLocator("Broad Street", zoom = FALSE)
streetNameLocator("broad street") streetNameLocator("Broad Street", zoom = -10) streetNameLocator("Broad Street", latlong = TRUE, zoom = -10) streetNameLocator("Broad Street", distance.unit = "yard") streetNameLocator("Broad Street", zoom = FALSE)
Unique road names from Snow's cholera map.
streetNames()
streetNames()
An R character vector.
See vignette("roads"), and roads and road.segment data frames.
Highlight selected road segment(s) and cases.
streetNumberLocator(street.number = 216, zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
streetNumberLocator(street.number = 216, zoom = TRUE, latlong = FALSE, cases = "address", token = "id", vestry = FALSE, add.pump = TRUE, add.title = TRUE, add.subtitle = TRUE, highlight = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, cex.text = 0.67)
street.number |
Character. A vector of segment IDs. See Note. |
zoom |
Logical or Numeric. Positive value zoom in. Negative values zoom out. |
latlong |
Logical. Longitude and latitude coordinates |
cases |
Character. Cases to plot: |
token |
Character. Cases as "id" or "point". |
vestry |
Logical. |
add.pump |
Logical. Include pumps. |
add.title |
Logical. Include title. |
add.subtitle |
Logical. Include subtitle. |
highlight |
Logical. Highlight selected segment(s) and cases. |
distance.unit |
Character. Unit of distance: "meter", "yard" or "native". "native" returns the map's native scale. See |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
cex.text |
Numeric. |
A base R graphics plot.
See cholera::roads
.
streetNumberLocator(216) streetNumberLocator(216, zoom = -10) streetNumberLocator(216, latlong = TRUE, zoom = -10) streetNumberLocator(216, distance.unit = "yard") streetNumberLocator(216, zoom = FALSE)
streetNumberLocator(216) streetNumberLocator(216, zoom = -10) streetNumberLocator(216, latlong = TRUE, zoom = -10) streetNumberLocator(216, distance.unit = "yard") streetNumberLocator(216, zoom = FALSE)
Return computed counts for Euclidean neighborhoods.
## S3 method for class 'euclidean' summary(object, ...)
## S3 method for class 'euclidean' summary(object, ...)
object |
Object. An object of class "euclidean" created by |
... |
Additional parameters. |
A vector of counts by neighborhood.
## Not run: summary(neighborhoodEuclidean()) ## End(Not run)
## Not run: summary(neighborhoodEuclidean()) ## End(Not run)
Return computed counts for Voronoi neighborhoods.
## S3 method for class 'voronoi' summary(object, ...)
## S3 method for class 'voronoi' summary(object, ...)
object |
Object. An object of class "voronoi" created by |
... |
Additional arguments. |
A vector of counts by neighborhood.
addVoronoi()
plot.voronoi()
Return computed counts for walking neighborhoods.
## S3 method for class 'walking' summary(object, ...)
## S3 method for class 'walking' summary(object, ...)
object |
Object. An object of class "walking" created by |
... |
Additional parameters. |
An R vector.
Soho elevation data.
tanakaContourPlot(add = FALSE)
tanakaContourPlot(add = FALSE)
add |
Logical. Add to exisiting plot. |
Aggregate time series fatality data from the Vestry report.
timeSeries(vestry = FALSE)
timeSeries(vestry = FALSE)
vestry |
Logical. |
A R list with two objects: "data" and "source" ("snow" or "vestry").
date
: Calendar date.
day
: Day of the week.
deaths
: Measure of fatality.
fatal.attacks
: Measure of fatality.
The "snow" data appears on p. 117 of the report; the "vestry" data appear in Appendix B on p.175.
plot.time_series
, print.time_series
, vignette("time.series")
timeSeries(vestry = TRUE) plot(timeSeries())
timeSeries(vestry = TRUE) plot(timeSeries())
Unstacks fatalities data by 1) assigning the coordinates of the base case to all cases in a stack and 2) setting the base case as an "address" and making the number of fatalities an attribute.
unstackFatalities(multi.core = TRUE, compute = FALSE, dev.mode = FALSE)
unstackFatalities(multi.core = TRUE, compute = FALSE, dev.mode = FALSE)
multi.core |
Logical or Numeric. |
compute |
Logical. |
dev.mode |
Logical. Development mode uses parallel::parLapply(). |
An R list that includes anchor.case
, fatalities.address
, fatalities.unstacked
and ortho.proj
.
This function is computationally intensive. This function documents the code that generates anchor.case
, fatalities.address
, fatalities.unstacked
and ortho.proj
.
vignette("unstacking.fatalities")
Coordinates of Voronoi polygon vertices for original map.
voronoi.polygons
voronoi.polygons
A list of 13 data frames frames with 5 variables.
vertex
vertex ID
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
Coordinates of Voronoi polygon vertices for Vestry Report map.
voronoi.polygons.vestry
voronoi.polygons.vestry
A list of 14 data frames frames with 5 variables.
vertex
vertex ID
x
x-coordinate
y
y-coordinate
lon
longitude
lat
latitude
For construction and plotting of Delaunay and Voronoi polygons.
voronoiPolygons(sites, rw.data = NULL, rw = NULL, type = "tiles", output = "vertices", latlong = FALSE)
voronoiPolygons(sites, rw.data = NULL, rw = NULL, type = "tiles", output = "vertices", latlong = FALSE)
sites |
Object. Data frame of sites to compute Delaunay triangulation and Dirichelet (Voronoi) tessellation with variables "x" and "y". |
rw.data |
Object. Data frame of secondary source of data to set the rectangular window or bounding box: observations, cases, etc. with variables "x" and "y". |
rw |
Numeric. Alternative to rw.data: vector of corners to define the rectangular window or bounding box: xmin, xmax, ymin, ymax. |
type |
Character. "tiles" (tessellation) or "triangles" (triangulation) vertices. |
output |
Character. "vertices" or "polygons". "vertices" re "polygons" will draw base R polygons() to an existing plot. |
latlong |
Logical. Use estimated longitude and latitude. |
An R list of data frames or base R graphics polygon()'s'.
This function relies on the 'deldir' package.
snowMap() voronoiPolygons(pumps, output = "polygons") snowMap() voronoiPolygons(pumps, roads, output = "polygons") snowMap() voronoiPolygons(pumps, roads, type = "triangles", output = "polygons") vertices <- voronoiPolygons(pumps, roads) snow.colors <- grDevices::adjustcolor(snowColors(), alpha.f = 1/3) snowMap(add.cases = FALSE) invisible(lapply(seq_along(vertices), function(i) { polygon(vertices[[i]], col = snow.colors[[i]]) }))
snowMap() voronoiPolygons(pumps, output = "polygons") snowMap() voronoiPolygons(pumps, roads, output = "polygons") snowMap() voronoiPolygons(pumps, roads, type = "triangles", output = "polygons") vertices <- voronoiPolygons(pumps, roads) snow.colors <- grDevices::adjustcolor(snowColors(), alpha.f = 1/3) snowMap(add.cases = FALSE) invisible(lapply(seq_along(vertices), function(i) { polygon(vertices[[i]], col = snow.colors[[i]]) }))
Group cases into neighborhoods based on walking distance.
walkingB(pump.select = NULL, vestry = FALSE, weighted = TRUE, case.set = "observed", latlong = FALSE, multi.core = TRUE)
walkingB(pump.select = NULL, vestry = FALSE, weighted = TRUE, case.set = "observed", latlong = FALSE, multi.core = TRUE)
pump.select |
Numeric. Vector of numeric pump IDs to define pump neighborhoods (i.e., the "population"). Negative selection possible. |
vestry |
Logical. |
weighted |
Logical. |
case.set |
Character. "observed", "expected" or "snow". "snow" captures John Snow's annotation of the Broad Street pump neighborhood printed in the Vestry report version of the map. |
latlong |
Logical. |
multi.core |
Logical or Numeric. |
Compute walking path from case/landmark to nearest or selected pump.
walkingPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE)
walkingPath(origin = 1, destination = NULL, type = "case-pump", vestry = FALSE, latlong = FALSE, case.set = "observed", location = "nominal", weighted = TRUE, distance.unit = "meter", time.unit = "second", walking.speed = 5, include.landmarks = TRUE)
origin |
Numeric. Vector of origin(s) (numeric or case/landmark name). |
destination |
Numeric. Vector of destination(s) (numeric or landmark/pump name). |
type |
Character. Path case to pump. FALSE is all other combinations of cases, landmarks and pumps. |
vestry |
Logical. |
latlong |
Logical. |
case.set |
Character. "observed" or "expected". |
location |
Character. For cases and pumps. "anchor, "fatality" or "orthogonal. |
weighted |
Logical. |
distance.unit |
Character. Unit of distance: "meter" or "yard". |
time.unit |
Character. "hour", "minute", or "second". |
walking.speed |
Numeric. Walking speed in km/hr. |
include.landmarks |
Logical. Include landmarks as cases. |
Gareth Stedman Jones Appendix 2, Table 12, p.384.
winterTemperatures()
winterTemperatures()
plot(winterTemperatures(), "1859-6-1")
plot(winterTemperatures(), "1859-6-1")