choropleth: Bin values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Choropleth.R

Description

choropleth discretizes the values of a quantity for mapping.

Usage

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

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

Value

a vector with the discretized values.

Author(s)

Barnabas H. Daru darunabas@gmail.com

See Also

coldspots

Examples

1
2
3
4
5
6
7
8
9
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])

phyloregion documentation built on May 1, 2021, 9:06 a.m.