This function builds a map that visualises estimates and errors simultaneously with rotated glyphs.

build_gmap(
  data,
  geoData = NULL,
  id = NULL,
  size = 50,
  border = NULL,
  glyph = "icone",
  palette = "Blues",
  limits = NULL,
  max_error = NULL
)

Arguments

data

A data frame.

geoData

A spatial polygons data frame.

id

Name of the common column shared by the objects passed to data and geoData. The estimates and errors in the data frame will be matched to the geographical regions of the spatial polygons data frame through this column.

size

An integer between 1 and 100. Value controls the size of the glyphs.

border

Name of geographical borders to be added to the map. It must be one of county, france, italy, nz, state, usa or world (see documentation for map_data for more information). The borders will be refined to match latitute and longtidue coordinates provided in the data frame or spatial polygons data frame.

glyph

Name of glyph shape. Options include icone and semi.

palette

Name of colour palette. It must be one of Blues, Greens, Greys, Oranges, Purples or Reds (see documentation for scale_fill_distiller for more information).

limits

Limits for the legend. Default is NULL, which takes the limits to be the range of the data.

max_error

maximum error value. Default is NULL, which takes the maximum from the error given

Details

If a spatial polygons data frame is used, glyphs will be plotted at region centroids. If geoData remains NULL, glyphs will be plotted at points on the map representing specific sites; in this case, the data frame must include latitude and longitude coordinates in columns "long" and "lat".

See also

Examples

data(us_data)
data(us_geo)
co_geo <- subset(us_geo, us_geo@data$STATE == "08")
us_data$GEO.id2 <- as.numeric(us_data$GEO.id2)
co_data <- subset(us_data, us_data$GEO.id2 > 8000 & us_data$GEO.id2 < 9000)
co_data <- read.uv(data = co_data, estimate = "pov_rate", error = "pov_moe")

# build a glyph map
map <- build_gmap(data = co_data, geoData = co_geo, id = "GEO_ID",
 size = 70, border = "state", glyph = "icone")
view(map)