author: “Jess”
date: “2024-10-22”
output:
html_document: theme: flatly
toc: true toc_float: true toc_depth: 2
code_folding: hide
number_sections: true fig_width: 7 fig_height: 5 highlight: tango
df_print: paged
Maps could make a compelling visualisation for a PPT with donors, in project proposals or donor reports to illustrate the context where we work, or the impact of our interventions.Possible uses include:
Right now its based on the old administrative boundries i.e 264 municipalities not the 44 that came into affect may 2024. But when we get the updated polygons, we can make upto-date maps.
## Total number of NAME_1 : 14
## Total number of NAME_2 : 266
We can see here the 7 districts where the HH was conducted highlited and labelled
## Reading layer `gadm41_SLV_2' from data source
## `C:\Users\jlloydevans\OneDrive - International Organization for Migration - IOM\Documentos\RStudio\Nueva carpeta2\gadm41_SLV_2.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 266 features and 13 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -90.12486 ymin: 13.15264 xmax: -87.68375 ymax: 14.45055
## Geodetic CRS: WGS 84
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: Removed 259 rows containing missing values or values outside the scale range
## (`geom_text()`).
## [1] "Unique department names from the survey data for District 1:"
## [1] "San Salvador" "Santa Ana" "La Libertad" "Chalatenango" "La Unión"
## [6] "Usulután"
## Reading layer `gadm41_SLV_1' from data source
## `C:\Users\jlloydevans\OneDrive - International Organization for Migration - IOM\Documentos\RStudio\Nueva carpeta2\gadm41_SLV_1.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 14 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -90.12486 ymin: 13.15264 xmax: -87.68375 ymax: 14.45055
## Geodetic CRS: WGS 84
## [1] "Unique department names from the shapefile:"
## [1] "Ahuachapán" "Cabañas" "Chalatenango" "Cuscatlán" "La Libertad"
## [6] "La Paz" "La Unión" "Morazán" "San Miguel" "San Salvador"
## [11] "San Vicente" "Santa Ana" "Sonsonate" "Usulután"
##
## No Yes
## 8 6
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_text()`).
We can also overlay this with variables in the HH dataset to create maps that explain charictarists of the surveyed population.
In this map, we overlay it hosuehold data which shows the mean income of all respondents who took the survey in these departments.
The darker colours represent a higher mean income
## Reading layer `gadm41_SLV_1' from data source
## `C:\Users\jlloydevans\OneDrive - International Organization for Migration - IOM\Documentos\RStudio\Nueva carpeta2\gadm41_SLV_1.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 14 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -90.12486 ymin: 13.15264 xmax: -87.68375 ymax: 14.45055
## Geodetic CRS: WGS 84
## Unique bingen Values:
## [1] 1 0 NA
## Counts of Each bingen Value:
##
## 0 1
## 11926 10224
## Male dataset (first few rows):
## # A tibble: 6 × 299
## i6_07 i6_05 h5 h3 g1 hogar factor encuesta departamento distrito
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr> <chr>
## 1 0 0 "02. No" 60 "02. N… 1000 28.1 118038 San Salvador Ilopango
## 2 0 0 "02. No" 60 "" 1000 28.1 118038 San Salvador Ilopango
## 3 0 0 "02. No" 60 "" 1000 28.1 118038 San Salvador Ilopango
## 4 0 0 "" <NA> "02. N… 10003 66.3 404149 Santa Ana Santa A…
## 5 0 0 "" <NA> "02. N… 10005 66.3 404150 Santa Ana Santa A…
## 6 0 0 "" <NA> "02. N… 10007 66.3 404151 Santa Ana Santa A…
## # ℹ 289 more variables: cod_distrito <dbl>, area <dbl+lbl>, canton <chr>,
## # fecha <date>, hora <dttm>, resultado_visita <chr>, consentimiento <chr>,
## # b1 <dbl+lbl>, b2 <chr>, b2_esp <chr>, b3 <chr>, b3_esp <chr>, b4 <chr>,
## # b4_esp <chr>, b5 <chr>, b6 <dbl+lbl>, b7 <dbl>, b8 <dbl+lbl>, c1 <chr>,
## # c1_01 <dbl>, c1_02 <dbl>, c1_03 <dbl>, c1_04 <dbl>, c1_05 <dbl>,
## # c1_06 <dbl>, c1_07 <dbl>, c1_08 <dbl>, c1_09 <dbl>, c1_10 <dbl>,
## # c1_11 <dbl>, c1_otro <dbl>, c1_99 <dbl>, c1_esp <chr>, c2 <chr>, …
## Female dataset (first few rows):
## # A tibble: 6 × 299
## i6_07 i6_05 h5 h3 g1 hogar factor encuesta departamento distrito
## <dbl> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr> <chr>
## 1 0 0 "02. No" 60 02. No 1000 28.1 118038 San Salvador Ilopango
## 2 0 0 "" <NA> 03. NS… 10003 66.3 404149 Santa Ana Santa A…
## 3 0 0 "" <NA> 03. NS… 10007 66.3 404151 Santa Ana Santa A…
## 4 0 0 "" <NA> 01. Sí 10007 66.3 404151 Santa Ana Santa A…
## 5 0 0 "01. Sí" 50 02. No 1001 28.1 118039 San Salvador Ilopango
## 6 0 0 "" <NA> 01. Sí 10011 66.3 404153 Santa Ana Santa A…
## # ℹ 289 more variables: cod_distrito <dbl>, area <dbl+lbl>, canton <chr>,
## # fecha <date>, hora <dttm>, resultado_visita <chr>, consentimiento <chr>,
## # b1 <dbl+lbl>, b2 <chr>, b2_esp <chr>, b3 <chr>, b3_esp <chr>, b4 <chr>,
## # b4_esp <chr>, b5 <chr>, b6 <dbl+lbl>, b7 <dbl>, b8 <dbl+lbl>, c1 <chr>,
## # c1_01 <dbl>, c1_02 <dbl>, c1_03 <dbl>, c1_04 <dbl>, c1_05 <dbl>,
## # c1_06 <dbl>, c1_07 <dbl>, c1_08 <dbl>, c1_09 <dbl>, c1_10 <dbl>,
## # c1_11 <dbl>, c1_otro <dbl>, c1_99 <dbl>, c1_esp <chr>, c2 <chr>, …
## Number of males: 10224
## Number of females: 11926
## Number of NA values in bingen column: 13
## Reading layer `gadm41_SLV_1' from data source
## `C:\Users\jlloydevans\OneDrive - International Organization for Migration - IOM\Documentos\RStudio\Nueva carpeta2\gadm41_SLV_1.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 14 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -90.12486 ymin: 13.15264 xmax: -87.68375 ymax: 14.45055
## Geodetic CRS: WGS 84