Draws estimates by department or district on the INEI boundaries
(fa_geometry()), ready for a paper: UTM zone 18S projection, a legend
by classes, department names, a north arrow, a scale bar in kilometres
and, around Peru, the Pacific Ocean, the neighbouring countries and a
locator inset of South America. Areas without an estimate are grey;
estimates that are only a reference (INEI "referencial": CV above 15% or
few cases) get an asterisk and a dashed outline.
Argumentos
- x
A table with one row per area, e.g. from
fa_estimate(),fa_indicator()orfa_link().- value
Column to map.
- level
"department"or"district".- key
Column with the area code. By default
department,ubigeo_base,ubigeoordomain, the first one found.- base
With
level = "district", the census year of the codes inx(e.g. 2017 afterfa_link()). The district boundaries are then merged into the districts of that year; districts that split from several of them stay grey.- percent
Show the values in percent.
- title
Map title.
- geometry
Boundaries to use instead of downloading them, an
sfobject withcodeandnameas returned byfa_geometry().- cache
Cache folder for the boundaries.
- breaks
How to group the values into classes:
"quantile"(each class with about the same number of areas),"pretty"(round limits), a numeric vector of limits, or"continuous"for a colour gradient without classes.- n
Number of classes.
- palette
A sequential palette from
grDevices::hcl.colors(), such as"YlOrRd","Teal","Purples"or"Viridis", light for low values and dark for high ones.- labels
"name"(department names),"code"(INEI codes) or"none". Districts are never labelled.- context
Draw the ocean, the neighbouring countries, the locator inset, the north arrow and the scale bar.
- legend
Legend title.
- quality
Column with the INEI quality band (
qualityinfa_estimate());NULLto ignore it.
Ejemplos
if (FALSE) { # \dontrun{
p <- fa_indicator("pobreza_monetaria", 2024, by = "department")
fa_map(p, title = "Monetary poverty 2024", legend = "Poor people")
fa_map(p, breaks = c(0, .1, .2, .3, .4, .5), palette = "Purples")
} # }
