choropleth {rflexscan} | R Documentation |
Display choropleth map
Description
Display choropleth map of detected clusters.
Usage
choropleth(
polygons,
fls,
col = palette(),
region_color = "#F0F0F0",
rank = 1:length(fls$cluster),
pval = 1,
...
)
Arguments
polygons |
A SpatialPolygonsDataFrame. |
fls |
An rflexscan object. |
col |
A vector of colors for each cluster. |
region_color |
Color of regions that are not included in any clusters. |
rank |
An integer vector which specifies ranks of clusters to be displayed. |
pval |
A threshold of P-value. Clusters with P-values of < |
... |
Other parameters to be passed to plot function. |
Details
Clusters are colored using the current palette. Please use palette function to specify colors of each cluster. Note that clusters with ranks larger than the number of colors in the palette are not highlighted.
See Also
Examples
# load sample data (North Carolina SIDS data)
library(sf)
library(spdep)
data("nc.sids")
sids.shp <- read_sf(system.file("shapes/sids.shp", package="spData")[1])
# calculate the expected numbers of cases
expected <- nc.sids$BIR74 * sum(nc.sids$SID74) / sum(nc.sids$BIR74)
# run FleXScan
fls <- rflexscan(x = nc.sids$x, y = nc.sids$y,
observed = nc.sids$SID74,
expected = expected,
name = rownames(nc.sids),
clustersize = 10,
nb = ncCR85.nb)
# display all clusters
choropleth(sids.shp, fls)
# display clusters with rank 1, 2 and 3
choropleth(sids.shp, fls, rank = c(1, 2, 3))
# display clusters of P-value <= 0.05
choropleth(sids.shp, fls, pval = 0.05)
[Package rflexscan version 1.1.0 Index]