map_sae: Map the disagregated estimates and the coefficients of...

View source: R/map_sae.R

map_saeR Documentation

Map the disagregated estimates and the coefficients of variation.

Description

map_sae produces geographical maps for the small area estimates or the direct estimaes among with their CVs.

Usage

map_sae(shapefile,
data,
area,
indicators,
color=c("green","red"),
breaks=FALSE,
main=FALSE,
output_data=FALSE)

Arguments

shapefile

object of class sf and data.frame as defined by the sf package containing shapefile informations, e.g. sa_shp. See also 'Details'.

data

data frame containing for the area of interest the information to be visualized, e.g. SAEval_example.

area

formula identifing the area of interest.

indicators

formula identifing the variables to be visualized.

color

a vector of 2 color defining the lowest and highest values in the plot

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'.

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.

Value

Returns maps, and, if selected, a data.frame containing the mapdata enriched with the indicators of interest.

Author(s)

Developed by Andrea Fasulo

References

Pebesma E., et al.,2021, "sf: Simple Features for R", CRAN repository https://CRAN.R-project.org/package=sf

Examples


# 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)



SAEval documentation built on March 31, 2023, 9 p.m.