Package 'popmex'

Title: Population Datasets of Mexico at Municipal and Hexagon Resolution
Description: Population datasets of Mexico for epidemiological analysis and to calculate rates: census population by municipality, sex and age group (INEGI ITER 2000, 2010 and 2020), municipal population reconstructions and projections 1990-2040 (CONAPO), and population in 400 m H3 hexagons (Kontur, Humanitarian Data Exchange, 2021-2023), with a function to extract the hexagons of urban localities, and a function to download the LandScan Global population raster (1 km) on demand.
Authors: Felipe Antonio Dzul Manzanilla [aut, cre] (ORCID: <https://orcid.org/0000-0002-2085-9141>), Fabián Correa-Morales [aut] (ORCID: <https://orcid.org/0000-0002-6193-1242>), Cecilia Cruz López [aut] (ORCID: <https://orcid.org/0000-0002-9156-5669>), Emmanuel Morales García [aut] (ORCID: <https://orcid.org/0000-0002-6837-9227>)
Maintainer: Felipe Antonio Dzul Manzanilla <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2026-10-24 11:27:16 UTC
Source: https://github.com/fdzul/popmex

Help Index


Population of the municipalities of Mexico, 1990-2040 (CONAPO)

Description

Reconstruction (1990-2020) and projections (2021-2040) of the mid-year population of the 2,475 municipalities of Mexico by sex and five-year age group, published by the National Population Council (CONAPO).

Usage

conapop

Format

A tibble with 252,450 rows (municipality x sex x year) and 24 columns:

cvegeo

five-digit municipality code of INEGI.

nom_ent

name of the state.

nom_mun

name of the municipality.

sexo

sex: '"HOMBRES"' (men) or '"MUJERES"' (women).

ano

year, 1990 to 2040.

pob_00_04

population aged 0 to 4 years.

pob_05_09

population aged 5 to 9 years.

pob_10_14

population aged 10 to 14 years.

pob_15_19

population aged 15 to 19 years.

pob_20_24

population aged 20 to 24 years.

pob_25_29

population aged 25 to 29 years.

pob_30_34

population aged 30 to 34 years.

pob_35_39

population aged 35 to 39 years.

pob_40_44

population aged 40 to 44 years.

pob_45_49

population aged 45 to 49 years.

pob_50_54

population aged 50 to 54 years.

pob_55_59

population aged 55 to 59 years.

pob_60_64

population aged 60 to 64 years.

pob_65_69

population aged 65 to 69 years.

pob_70_74

population aged 70 to 74 years.

pob_75_79

population aged 75 to 79 years.

pob_80_84

population aged 80 to 84 years.

pob_85_mm

population aged 85 years and over.

pob_total

total population.

Source

<https://www.gob.mx/conapo/documentos/reconstruccion-y-proyecciones-de-la-poblacion-de-los-municipios-de-mexico-1990-2040>


Extract the population of a locality in 400 m H3 hexagons

Description

Selects the hexagons of the Kontur/HDX population density dataset ('hdx_pop2021', 'hdx_pop2022' or 'hdx_pop2023') that intersect one or several urban localities of a state. The locality boundaries come from the INEGI 2019 localities of the [rgeomex](https://fdzul.github.io/rgeomex/) package.

Usage

extract_pop(year = 2023, cve_edo, locality)

Arguments

year

year of the population dataset: 2021, 2022 or 2023.

cve_edo

two-digit state code of INEGI, as text (e.g. '"14"' for Jalisco, '"31"' for Yucatán).

locality

name or names of the target localities. The names do not need to be exact: the most similar name of the state is used (e.g. '"Merida"' finds '"Mérida"').

Value

an 'sf' object (EPSG:4326) with the hexagons that intersect the localities and their population ('population').

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

See Also

[hdx_pop2023], [hdx_pop2022], [hdx_pop2021], [rgeomex::extract_locality()]

Examples

if (requireNamespace("rgeomex", quietly = TRUE)) {
  merida <- extract_pop(year = 2023, cve_edo = "31", locality = "Merida")
  sum(merida$population)
}

Download the LandScan population raster of Mexico

Description

Downloads (only the first time) the LandScan population raster of Mexico published as an asset of a GitHub release of popmex, and returns it as a 'SpatRaster'. The file is kept in a local cache, so later calls read it from disk without downloading it again.

Usage

get_landscan(
  url =
    "https://github.com/fdzul/popmex/releases/download/landscan-data/pop_LandScan.tif",
  refresh = FALSE
)

Arguments

url

address of the file. By default, the asset 'pop_LandScan.tif' of the release 'landscan-data' of the popmex repository.

refresh

if 'TRUE', download the file again even if it is cached.

Value

a 'terra::SpatRaster' with the estimated population per cell.

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Source

LandScan Global, Oak Ridge National Laboratory (ORNL), <https://landscan.ornl.gov>.

Examples

if (requireNamespace("terra", quietly = TRUE)) {
  r <- get_landscan()
  r
}

Population in 400 m H3 hexagons of Mexico, 2021 (Kontur / HDX)

Description

Estimated number of inhabitants in each H3 hexagon of resolution 8 (about 400 m across) of Mexico, from the Kontur Population dataset published in the Humanitarian Data Exchange (HDX). Only hexagons with population are included. This edition has no 'h3' column.

Usage

hdx_pop2021

Format

An 'sf' data frame (EPSG:4326, MULTIPOLYGON geometries) with 362,028 rows:

population

estimated number of inhabitants in the hexagon.

geom

hexagon geometry.

Source

<https://data.humdata.org/dataset/kontur-population-mexico>

See Also

[extract_pop()] to extract the hexagons of a locality.


Population in 400 m H3 hexagons of Mexico, 2022 (Kontur / HDX)

Description

Estimated number of inhabitants in each H3 hexagon of resolution 8 (about 400 m across) of Mexico, from the Kontur Population dataset published in the Humanitarian Data Exchange (HDX). Only hexagons with population are included.

Usage

hdx_pop2022

Format

An 'sf' data frame (EPSG:4326, POLYGON geometries) with 463,830 rows:

h3

H3 index of the hexagon (resolution 8).

population

estimated number of inhabitants in the hexagon.

geom

hexagon geometry.

Source

<https://data.humdata.org/dataset/kontur-population-mexico>

See Also

[extract_pop()] to extract the hexagons of a locality.


Population in 400 m H3 hexagons of Mexico, 2023 (Kontur / HDX)

Description

Estimated number of inhabitants in each H3 hexagon of resolution 8 (about 400 m across) of Mexico, from the Kontur Population dataset published in the Humanitarian Data Exchange (HDX). Only hexagons with population are included.

Usage

hdx_pop2023

Format

An 'sf' data frame (EPSG:4326, POLYGON geometries) with 456,514 rows:

h3

H3 index of the hexagon (resolution 8).

population

estimated number of inhabitants in the hexagon.

geom

hexagon geometry.

Source

<https://data.humdata.org/dataset/kontur-population-mexico>

See Also

[extract_pop()] to extract the hexagons of a locality.


Population by municipality of Mexico, ITER 2000

Description

Population of each municipality of Mexico by sex and age group, from the territorial indicators (ITER, *Integración Territorial*) of the 2000 Population and Housing Census of INEGI. Useful as denominators to calculate incidence rates.

Usage

pop2000

Format

A tibble with 2,443 rows (municipalities) and 4 columns. All population columns are numeric:

CVEGEO

five-digit municipality code of INEGI (state + municipality).

pobtot

total population.

pobfem

female population.

pobmas

male population.

Source

<https://www.inegi.org.mx/app/scitel/Default?ev=9>


Population by municipality of Mexico, ITER 2010

Description

Population of each municipality of Mexico by sex and age group, from the territorial indicators (ITER, *Integración Territorial*) of the 2010 Population and Housing Census of INEGI. Useful as denominators to calculate incidence rates.

Usage

pop2010

Format

A tibble with 2,456 rows (municipalities) and 44 columns. All population columns are numeric:

CVEGEO

five-digit municipality code of INEGI (state + municipality).

pobtot

total population.

pobfem

female population.

pobmas

male population.

p_0a2

population aged 0 to 2 years.

p_0a2_f

female population aged 0 to 2 years.

p_0a2_m

male population aged 0 to 2 years.

p_3ymas

population aged 3 years and over.

p_3ymas_f

female population aged 3 years and over.

p_3ymas_m

male population aged 3 years and over.

p_5ymas

population aged 5 years and over.

p_5ymas_f

female population aged 5 years and over.

p_5ymas_m

male population aged 5 years and over.

p_12ymas

population aged 12 years and over.

p_12ymas_f

female population aged 12 years and over.

p_12ymas_m

male population aged 12 years and over.

p_15ymas

population aged 15 years and over.

p_15ymas_f

female population aged 15 years and over.

p_15ymas_m

male population aged 15 years and over.

p_18ymas

population aged 18 years and over.

p_18ymas_f

female population aged 18 years and over.

p_18ymas_m

male population aged 18 years and over.

p_3a5

population aged 3 to 5 years.

p_3a5_f

female population aged 3 to 5 years.

p_3a5_m

male population aged 3 to 5 years.

p_6a11

population aged 6 to 11 years.

p_6a11_f

female population aged 6 to 11 years.

p_6a11_m

male population aged 6 to 11 years.

p_8a14

population aged 8 to 14 years.

p_8a14_f

female population aged 8 to 14 years.

p_8a14_m

male population aged 8 to 14 years.

p_12a14

population aged 12 to 14 years.

p_12a14_f

female population aged 12 to 14 years.

p_12a14_m

male population aged 12 to 14 years.

p_15a17

population aged 15 to 17 years.

p_15a17_f

female population aged 15 to 17 years.

p_15a17_m

male population aged 15 to 17 years.

p_18a24

population aged 18 to 24 years.

p_18a24_f

female population aged 18 to 24 years.

p_18a24_m

male population aged 18 to 24 years.

p_15a49_f

female population aged 15 to 49 years.

p_60ymas

population aged 60 years and over.

p_60ymas_f

female population aged 60 years and over.

p_60ymas_m

male population aged 60 years and over.

Source

<https://www.inegi.org.mx/app/scitel/Default?ev=9>


Population by municipality of Mexico, ITER 2020

Description

Population of each municipality of Mexico by sex and age group, from the territorial indicators (ITER, *Integración Territorial*) of the 2020 Population and Housing Census of INEGI. Useful as denominators to calculate incidence rates.

Usage

pop2020

Format

A tibble with 2,469 rows (municipalities) and 44 columns. All population columns are numeric:

CVEGEO

five-digit municipality code of INEGI (state + municipality).

pobtot

total population.

pobfem

female population.

pobmas

male population.

p_0a2

population aged 0 to 2 years.

p_0a2_f

female population aged 0 to 2 years.

p_0a2_m

male population aged 0 to 2 years.

p_3ymas

population aged 3 years and over.

p_3ymas_f

female population aged 3 years and over.

p_3ymas_m

male population aged 3 years and over.

p_5ymas

population aged 5 years and over.

p_5ymas_f

female population aged 5 years and over.

p_5ymas_m

male population aged 5 years and over.

p_12ymas

population aged 12 years and over.

p_12ymas_f

female population aged 12 years and over.

p_12ymas_m

male population aged 12 years and over.

p_15ymas

population aged 15 years and over.

p_15ymas_f

female population aged 15 years and over.

p_15ymas_m

male population aged 15 years and over.

p_18ymas

population aged 18 years and over.

p_18ymas_f

female population aged 18 years and over.

p_18ymas_m

male population aged 18 years and over.

p_3a5

population aged 3 to 5 years.

p_3a5_f

female population aged 3 to 5 years.

p_3a5_m

male population aged 3 to 5 years.

p_6a11

population aged 6 to 11 years.

p_6a11_f

female population aged 6 to 11 years.

p_6a11_m

male population aged 6 to 11 years.

p_8a14

population aged 8 to 14 years.

p_8a14_f

female population aged 8 to 14 years.

p_8a14_m

male population aged 8 to 14 years.

p_12a14

population aged 12 to 14 years.

p_12a14_f

female population aged 12 to 14 years.

p_12a14_m

male population aged 12 to 14 years.

p_15a17

population aged 15 to 17 years.

p_15a17_f

female population aged 15 to 17 years.

p_15a17_m

male population aged 15 to 17 years.

p_18a24

population aged 18 to 24 years.

p_18a24_f

female population aged 18 to 24 years.

p_18a24_m

male population aged 18 to 24 years.

p_15a49_f

female population aged 15 to 49 years.

p_60ymas

population aged 60 years and over.

p_60ymas_f

female population aged 60 years and over.

p_60ymas_m

male population aged 60 years and over.

Source

<https://www.inegi.org.mx/app/scitel/Default?ev=9>