choropleth: Binning shapefile polygons based on slot values

Description Usage Arguments Value Examples

View source: R/choropleth.R

Description

The choropleth function discretizes the values of a quantity based on their quantiles.

Usage

1
choropleth(x, values, k = 10, ...)

Arguments

x

An object of the class SpatialPolygonsDataFrame.

values

The column in the SpatialPolygonsDataFrame for which to discretize the values of the quantity.

k

Numeric, the desired number of bins to discretize.

...

Further arguments passed to or from other methods.

Value

choropleth

returns a SpatialPolygonsDataFrame with a column with the discretized values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(raster)
s <- readRDS(system.file("nigeria/SR_Naija.rds", package= "bioregion"))
k=10
COLOUR <- colorRampPalette(c("blue", "yellow", "red"))(k)
y = choropleth(s, values=s$SR, k)
 
## Not run: 
plot(y, col=COLOUR[y$values], border = NA)
 
## End(Not run)

darunabas/bioregion documentation built on Oct. 27, 2019, 6:57 a.m.