Learn R Programming

phyloregion (version 1.0.6)

choropleth: Bin values

Description

choropleth discretizes the values of a quantity for mapping.

Usage

choropleth(x, k = 10, breaks = "quantile", min = NULL, max = NULL)

Value

a vector with the discretized values.

Arguments

x

Vector of values to discretize.

k

Numeric, the desired number of bins to discretize.

breaks

one of “equal”, “pretty”, “jenks”, “quantile” or numeric vector with the actual breaks by specifying the minimum (min) and maximum (max) bounds.

min

the minima of the lowest bound of the break.

max

the maxima of the upper bound of the break

Author

Barnabas H. Daru darunabas@gmail.com

See Also

coldspots

Examples

Run this code
library(sp)
s <- readRDS(system.file("nigeria/SR_Naija.rds", package = "phyloregion"))
k <- 10
COLOUR <- hcl.colors(k, "RdYlBu")
y <- choropleth(s$SR, k)

plot(s$SR, y)
## To plot and color according to some metric:
plot(s, col = COLOUR[y])

Run the code above in your browser using DataLab