map_sae | R Documentation |
map_sae
produces geographical maps for the small area estimates or the direct estimaes among with their CVs.
map_sae(shapefile,
data,
area,
indicators,
color=c("green","red"),
breaks=FALSE,
main=FALSE,
output_data=FALSE)
shapefile |
object of class |
data |
data frame containing for the area of interest the information to be visualized, e.g. |
area |
formula identifing the area of interest. |
indicators |
formula identifing the variables to be visualized. |
color |
a |
breaks |
list containing the endpoints for each indicator of interest (default=FALSE). |
main |
logical scalar. Should the maps include a main title (default=FALSE)?. See also 'Details'. |
output_data |
logical scalar. Should the funtion returns a data frame including the map data among with the indicators of interest (default=FALSE)?. See also 'Details'. |
shapefile
object can be created with the sf
package using the function st_read
.
If main
is equal to TRUE
the name of the indicator will be used as main title of the map.
When output_data
is equal to TRUE
a map data object is returned so can be easaly maneged using ggplot
for a better graphical personalizzation.
Returns maps, and, if selected, a data.frame containing the mapdata enriched with the indicators of interest.
Developed by Andrea Fasulo
Pebesma E., et al.,2021, "sf: Simple Features for R", CRAN repository https://CRAN.R-project.org/package=sf
# Load example data and shape file
data(SAEval_example);data(sa_shp)
SAEval_example$cv_d<-sqrt(SAEval_example$mse_d)/SAEval_example$y_d
SAEval_example$cv_sa<-sqrt(SAEval_example$mse_sa)/SAEval_example$y_syna
# Without using breaks
map_sae(shapefile=sa_shp,data=SAEval_example,area=~sa,indicators=~y_d+cv_d+y_syna+cv_sa,main=TRUE)
# Using breaks
map_sae(shapefile=sa_shp,data=SAEval_example,area=~sa,indicators=~y_d+cv_d+y_syna+cv_sa,
breaks=list(seq(0,40000,5000),seq(0,1.5,0.15),seq(0,40000,5000),seq(0,1.5,0.15)),main=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.