Skip to contents

This function adds the key information of a demographic dataset to a geospatial dataset based on the spatial aggregation level. Since the smallest level of spatial aggregation present in the demographic datasets is municipality, this function can only merge with geospatial datasets that present municipality or department level.

Usage

merge_geo_demographic(demographic_dataset, simplified = TRUE)

Arguments

demographic_dataset

character with the demographic dataset name. Please use list_datasets("demographic", "EN") or list_datasets("demographic", "ES") to check available datasets.

simplified

logical for indicating if the downloaded spatial data should be a simplified version of the geometries. Simplified versions are lighter but less precise, and are recommended for easier applications like plots. Default is TRUE.

Value

data.frame object with the merged data.

Examples

# \donttest{
merged <- merge_geo_demographic("DANE_CNPVV_2018_9VD", TRUE)
#> Original data is retrieved from the National Administrative Department
#> of Statistics (Departamento Administrativo Nacional de Estadística -
#> DANE).
#> Reformatted by package authors.
#> Stored by Universidad de Los Andes under the Epiverse TRACE iniative.
head(merged)
#> Simple feature collection with 6 features and 14 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -77.12783 ymin: 3.730633 xmax: -71.94885 ymax: 11.10537
#> Geodetic CRS:  WGS 84
#>   codigo_departamento departamento version        area   latitud  longitud
#> 1                  05    Antioquia    2018 62804708983  6.922796 -75.56499
#> 2                  08    Atlántico    2018  3315752105 10.677010 -74.96522
#> 3                  11 Bogotá, D.C.    2018  1622852605  4.316108 -74.18107
#> 4                  13      Bolívar    2018 26719196397  8.745271 -74.50864
#> 5                  15       Boyacá    2018 23138048132  5.776607 -73.10207
#> 6                  17       Caldas    2018  7425221672  5.342066 -75.30688
#>   total_viviendas_ocupadas_con_personas_presentes
#> 1                                         1933583
#> 2                                          598179
#> 3                                         2345190
#> 4                                          509169
#> 5                                          369111
#> 6                                          304509
#>   inodoro_conectado_al_alcantarillado_solo_aplica_para_viviendas_que_cuentan_con_servicio_de_alcantarillado
#> 1                                                                                                   1563592
#> 2                                                                                                    503712
#> 3                                                                                                   2287247
#> 4                                                                                                    254361
#> 5                                                                                                    226936
#> 6                                                                                                    241415
#>   inodoro_conectado_a_pozo_septico inodoro_sin_conexion letrina
#> 1                           197767                43731    4295
#> 2                            74413                 1982    1397
#> 3                            20782                 1826     257
#> 4                           185116                 5455    6645
#> 5                           101767                17279    1377
#> 6                            40454                 5671    1535
#>   inodoro_con_descarga_directa_a_fuentes_de_agua_bajamar
#> 1                                                  77098
#> 2                                                   2026
#> 3                                                   4537
#> 4                                                   3189
#> 5                                                   3826
#> 6                                                  10747
#>   no_tiene_servicio_sanitario sin_informacion                           geom
#> 1                       34531           12569 MULTIPOLYGON (((-74.83058 8...
#> 2                       11123            3526 MULTIPOLYGON (((-74.91077 1...
#> 3                        1310           29231 MULTIPOLYGON (((-74.15067 4...
#> 4                       51816            2587 MULTIPOLYGON (((-76.17318 9...
#> 5                       14449            3477 MULTIPOLYGON (((-72.04767 7...
#> 6                        2768            1919 MULTIPOLYGON (((-74.66496 5...
# }