| Title: | Load Microdata from Colombia's 'GEIH' ('DANE') |
|---|---|
| Description: | Programmatic access to microdata from Colombia's Gran Encuesta Integrada de Hogares ('GEIH'), published by 'DANE'. Provides a tidy interface to download, parse, and harmonize labor market surveys from 2007 to present. R companion to the 'pulso-co' 'Python' package. |
| Authors: | Esteban Labastidas [aut, cre] |
| Maintainer: | Esteban Labastidas <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.0 |
| Built: | 2026-11-28 17:09:25 UTC |
| Source: | https://github.com/stebandido77/pulso |
Deletes cached files under the pulso cache directory
(tools::R_user_dir("pulso", "cache"), or the pulso.cache_dir
option): the downloaded DANE zips ("raw"), the parsed modules
stored as parquet ("parsed", only written when the 'arrow' package
is installed), or both. Mirrors pulso.cache_clear() in 'Python'.
pulso_clear_cache(level = c("all", "raw", "parsed"))pulso_clear_cache(level = c("all", "raw", "parsed"))
level |
Character. One of |
Invisibly, the paths that were removed.
if (interactive()) { pulso_clear_cache("parsed") }if (interactive()) { pulso_clear_cache("parsed") }
Adds <col>_real = nominal * IPC(deflate_to) / IPC(periodo of the
row). Mirrors pulso.deflactar() in 'Python'.
pulso_deflactar(df, columns, deflate_to, periodo_col = "periodo", ipc_table = NULL)pulso_deflactar(df, columns, deflate_to, periodo_col = "periodo", ipc_table = NULL)
df |
A data frame with a |
columns |
Character. Nominal peso columns to deflate. |
deflate_to |
Character. Reference month "YYYY-MM". |
periodo_col |
Character. Name of the period column. |
ipc_table |
Optional output of |
df with the <col>_real columns added.
df <- data.frame(periodo = "2018-12", inglabo = 1000) pulso_deflactar(df, "inglabo", "2026-09", ipc_table = pulso_ipc(use_fixture = TRUE))df <- data.frame(periodo = "2018-12", inglabo = 1000) pulso_deflactar(df, "inglabo", "2026-09", ipc_table = pulso_ipc(use_fixture = TRUE))
Returns a human-readable summary of a GEIH survey module: its survey level, available epochs, and harmonized canonical variables.
pulso_describe(module)pulso_describe(module)
module |
Character. Module name (e.g., "ocupados"). Must be one of the modules registered in sources.json. |
A multi-line character string.
pulso_describe("ocupados")pulso_describe("ocupados")
Pretty-prints metadata for a column in a tibble loaded with
metadata = TRUE. Output format mirrors Python's
pulso.describe_column().
pulso_describe_column(df, column)pulso_describe_column(df, column)
df |
A tibble loaded with |
column |
Character. Column name to describe. |
A multi-line character string.
if (interactive()) { df <- pulso_load(2024, 6, "ocupados", metadata = TRUE) cat(pulso_describe_column(df, "P6430")) }if (interactive()) { df <- pulso_load(2024, 6, "ocupados", metadata = TRUE) cat(pulso_describe_column(df, "P6430")) }
Returns a human-readable summary of a canonical variable defined in variable_map.json: its module, description, source mappings per epoch, and any comparability warning.
pulso_describe_variable(variable_name)pulso_describe_variable(variable_name)
variable_name |
Character. Canonical variable name (e.g., "sexo"). The lookup is case-insensitive. |
A single multi-line character string.
pulso_describe_variable("sexo") pulso_describe_variable("edad")pulso_describe_variable("sexo") pulso_describe_variable("edad")
Computes the unemployment rate (TD), employment rate (TO) and global
participation rate (TGP), plus the levels of the working-age population
(PET), labor force (FT), employed and unemployed, with DANE's definitions:
PET is 12+ in cabeceras and 10+ in centros poblados and rural disperso on
the 2005 census frame, and 15+ on the 2018 frame (2022 onwards, and 2020);
employed / unemployed / inactive come from DANE's per-module flags
(OCI, DSI, INI on the 2005 frame; OCI, DSI, FFT on the 2018 frame).
Mirrors pulso.indicadores() in 'Python'.
Point estimates only: the public GEIH microdata have no design variables
(strata, PSU), so standard errors are not computed (se is NA).
DANE publishes confidence limits and relative errors in the "Errores
relativos" sheet of its monthly annex.
pulso_indicadores( start, end = NULL, dominio = c("nacional", "cabeceras", "centros_poblados_rural", "13_ciudades", "23_ciudades", "ciudad", "departamento"), trimestre_movil = FALSE, strict = FALSE, cache = TRUE )pulso_indicadores( start, end = NULL, dominio = c("nacional", "cabeceras", "centros_poblados_rural", "13_ciudades", "23_ciudades", "ciudad", "departamento"), trimestre_movil = FALSE, strict = FALSE, cache = TRUE )
start, end
|
Character |
dominio |
Character. One of "nacional", "cabeceras", "centros_poblados_rural", "13_ciudades", "23_ciudades" (cities with their metropolitan areas, DANE's AREA codes), "ciudad" (one row per AREA code) or "departamento" (one row per DPTO). |
trimestre_movil |
Logical. Pool each month with the two before it, with the expansion factor divided by 3. Default FALSE. |
strict, cache
|
Passed to |
A tibble with periodo, meses, dominio,
grupo, pet, ft, oc, ds (persons),
td, to, tgp (percent) and se (NA). Months that
cannot be computed are skipped with a warning.
if (interactive()) { pulso_indicadores("2026-01", "2026-09") pulso_indicadores("2026-09", dominio = "ciudad", trimestre_movil = TRUE) }if (interactive()) { pulso_indicadores("2026-01", "2026-09") pulso_indicadores("2026-09", dominio = "ciudad", trimestre_movil = TRUE) }
Returns the IPC index as a tibble. Same interface as pulso_tpm:
by default downloads the newest anex-IPC-Indices-<mes><anio>.xlsx
linked from DANE's IPC page and falls back to a bundled snapshot
(2003-01 to 2026-10). Mirrors pulso.ipc() in 'Python'.
pulso_ipc(use_fixture = NULL)pulso_ipc(use_fixture = NULL)
use_fixture |
Logical or NULL. NULL (default): try DANE, fall back to the snapshot. TRUE: always use the snapshot. FALSE: force the download. |
A tibble with periodo ("YYYY-MM"), anio, mes,
indice.
if (interactive()) { tail(pulso_ipc()) }if (interactive()) { tail(pulso_ipc()) }
Returns a tibble summary of all columns with their metadata.
pulso_list_columns_metadata(df)pulso_list_columns_metadata(df)
df |
A tibble loaded with |
A tibble with columns: column, label, type, module, source, has_categories.
if (interactive()) { df <- pulso_load(2024, 6, "ocupados", metadata = TRUE) summary <- pulso_list_columns_metadata(df) print(summary) }if (interactive()) { df <- pulso_load(2024, 6, "ocupados", metadata = TRUE) summary <- pulso_list_columns_metadata(df) print(summary) }
Returns the registry entries for which the downloaded data has been manually validated against DANE published figures.
pulso_list_validated_range()pulso_list_validated_range()
A tibble with one row per validated (year, month) pair, with
columns: year (integer), month (integer),
epoch (character), validated (logical, always TRUE),
validated_at (character, ISO-8601 or NA),
num_modules (integer).
Sorted by year, month ascending.
pulso_list_validated_range()pulso_list_validated_range()
Returns a tibble summarizing all canonical variables defined in variable_map.json, optionally filtered by module.
pulso_list_variables(module = NULL)pulso_list_variables(module = NULL)
module |
Character or NULL. When non-NULL, restricts output to
variables whose |
A tibble with one row per variable and columns:
chr. Key used throughout the pulso package.
chr. Survey module the variable belongs to.
chr. Spanish description, or NA if absent.
chr. Always NA in this version (see Note).
lgl. TRUE when a comparability_warning is
present and non-empty for the variable.
int. Number of epoch mappings defined.
Rows are sorted ascending by canonical_name.
The comparability column is always NA_character_ in the
current version because the comparability field (expected values:
"high" / "limited") has not yet been added to variable_map.json.
Only comparability_warning (free text) is present in the data.
# All variables pulso_list_variables() # Subset by module pulso_list_variables(module = "ocupados")# All variables pulso_list_variables() # Subset by module pulso_list_variables(module = "ocupados")
Downloads and parses microdata from Colombia's Gran Encuesta Integrada de Hogares (GEIH), published by DANE.
pulso_load( year, month, module, area = NULL, harmonize = TRUE, cache = TRUE, metadata = FALSE, strict = FALSE, allow_unvalidated = NULL, columns = NULL )pulso_load( year, month, module, area = NULL, harmonize = TRUE, cache = TRUE, metadata = FALSE, strict = FALSE, allow_unvalidated = NULL, columns = NULL )
year |
Integer. Year (2007 to current year). |
month |
Integer. Month (1-12). |
module |
Character. Module name (e.g., "ocupados"). |
area |
Character or NULL. Optional area filter. NOT IMPLEMENTED in v0.1.0. |
harmonize |
Logical. Whether to apply harmonization. Default TRUE. |
cache |
Logical. Whether to cache downloads. Default TRUE. |
metadata |
Logical. Whether to attach DANE metadata to result.
Default FALSE for Python parity. When TRUE, attaches metadata via
|
strict |
Logical. When FALSE (default, same as 'pulso-co' in
'Python'), periods not yet manually validated against DANE published
figures are loaded with a one-time warning per period. When TRUE,
such periods raise |
allow_unvalidated |
Deprecated. Use |
columns |
Character or NULL. Columns to keep (DANE names, matched
case-insensitively; |
When cache = TRUE and the 'arrow' package is installed,
the parsed module is also cached as parquet under the pulso cache
directory, so the next load of the same period and module skips the
zip and the CSV parsing. The cache key includes the download URL, the
module, the parser version and the period's catalog entry. Without
'arrow' nothing changes. Clear it with pulso_clear_cache("parsed").
A tibble with the microdata. If metadata = TRUE, the tibble has an attribute "pulso_metadata" with structured column info.
if (interactive()) { df <- pulso_load(year = 2024, month = 6, module = "ocupados", metadata = TRUE) cat(pulso_describe_column(df, "P6430")) }if (interactive()) { df <- pulso_load(year = 2024, month = 6, module = "ocupados", metadata = TRUE) cat(pulso_describe_column(df, "P6430")) }
Downloads, parses, and joins microdata from multiple GEIH modules for a single year-month. All modules must be at the same survey level (persona or hogar).
pulso_load_merged( year, month, modules, harmonize = TRUE, cache = TRUE, metadata = FALSE, strict = FALSE, allow_unvalidated = NULL )pulso_load_merged( year, month, modules, harmonize = TRUE, cache = TRUE, metadata = FALSE, strict = FALSE, allow_unvalidated = NULL )
year |
Integer. Year (2007 to current year). |
month |
Integer. Month (1-12). |
modules |
Character vector. Module names to merge (length >= 2).
Use |
harmonize |
Logical. Whether to lowercase column names. Default TRUE. |
cache |
Logical. Whether to cache downloads. Default TRUE. |
metadata |
Logical. Whether to attach DANE metadata. Default FALSE. When TRUE, metadata is composed from the first module's column index (multi-module metadata composition is planned for a future release). |
strict |
Logical. Passed through to each |
allow_unvalidated |
Deprecated; see |
A tibble with columns from all requested modules, joined on shared identifier keys (directorio, secuencia_p, orden for persona-level modules). The join is an outer join by default so that modules covering different person subsets (e.g., ocupados vs desocupados) are combined correctly.
Mixed-level merges (persona + hogar modules in the same call) are deferred to v0.2.0. If you need a hogar-level module, merge the result manually after separate calls.
if (interactive()) { df <- pulso_load_merged(2024, 6, c("ocupados", "caracteristicas_generales")) nrow(df) }if (interactive()) { df <- pulso_load_merged(2024, 6, c("ocupados", "caracteristicas_generales")) nrow(df) }
Loads every month from start to end with
pulso_load and stacks them with a periodo column
("YYYY-MM"). Mirrors pulso.load_range() in 'Python'.
pulso_load_range( start, end, module, harmonize = TRUE, cache = TRUE, strict = FALSE, columns = NULL, average_weights = FALSE, deflate_to = NULL, income_columns = NULL )pulso_load_range( start, end, module, harmonize = TRUE, cache = TRUE, strict = FALSE, columns = NULL, average_weights = FALSE, deflate_to = NULL, income_columns = NULL )
start, end
|
Character. Inclusive bounds, |
module |
Character. Module name (e.g., "ocupados"). |
harmonize, cache, strict, columns
|
Passed to |
average_weights |
Logical. If TRUE, add |
deflate_to |
Character or NULL. If given ("YYYY-MM"), add
|
income_columns |
Character or NULL. Columns to deflate. Default:
|
A warning is raised when the range mixes microdata on the 2005 and the 2018 census frames (2022-01 onwards, and 2020, whose files DANE re-weighted to the 2018 census): levels and rates are not comparable across frames.
A tibble with periodo, year and month columns
plus the module's columns (columns missing in some months are NA there).
if (interactive()) { oc <- pulso_load_range("2026-07", "2026-09", "ocupados", average_weights = TRUE) sum(oc$peso_expansion_promedio) # moving-quarter employed population }if (interactive()) { oc <- pulso_load_range("2026-07", "2026-09", "ocupados", average_weights = TRUE) sum(oc$peso_expansion_promedio) # moving-quarter employed population }
Bundled table of Colombia's monthly legal minimum wage (without the
transport allowance), 2007-2026, with the decree that set each value and
the official page where it was verified. Mirrors
pulso.salario_minimo() in 'Python'.
pulso_salario_minimo()pulso_salario_minimo()
A tibble with anio, smmlv, decreto,
fuente.
pulso_salario_minimo()pulso_salario_minimo()
Returns Colombia's monetary policy rate as a tibble. Data source: Banco de la Republica SDMX API (DF_CBR_DAILY_HIST). When the API is unavailable, falls back to a bundled snapshot extending to 2026-04-21.
pulso_tpm(start = NULL, end = NULL, use_fixture = NULL)pulso_tpm(start = NULL, end = NULL, use_fixture = NULL)
start |
Optional start date as character "YYYY-MM-DD" or Date. |
end |
Optional end date as character "YYYY-MM-DD" or Date. |
use_fixture |
Logical or NULL. If NULL (default), auto-detect: tries API first, falls back to snapshot if unavailable. If TRUE, always use bundled snapshot. If FALSE, force API call. |
A tibble with columns:
Date. Observation date.
numeric. TPM rate in percentage points.
character. Always "tpm".
if (interactive()) { # Recent TPM tpm_2024 <- pulso_tpm(start = "2024-01-01", end = "2024-12-31") # Full history (uses fixture if API down) tpm_all <- pulso_tpm() }if (interactive()) { # Recent TPM tpm_2024 <- pulso_tpm(start = "2024-01-01", end = "2024-12-31") # Full history (uses fixture if API down) tpm_all <- pulso_tpm() }
Returns Colombia's Tasa Representativa del Mercado as a tibble with one
row per calendar day. Data source: the Superintendencia Financiera's
dataset on datos.gov.co (32sa-8pi3); the Superfinanciera is the
entity that certifies the TRM. Each certified value covers a validity
window (Friday's value covers the weekend), which is expanded to days.
When the live call fails, falls back to a bundled snapshot extending to
2026-11-30. Same interface as pulso_tpm; mirrors
pulso.trm() in 'Python'.
pulso_trm(start = NULL, end = NULL, use_fixture = NULL)pulso_trm(start = NULL, end = NULL, use_fixture = NULL)
start |
Optional start date as character "YYYY-MM-DD" or Date. |
end |
Optional end date as character "YYYY-MM-DD" or Date. |
use_fixture |
Logical or NULL. If NULL (default), try the live dataset and fall back to the snapshot. If TRUE, always use the bundled snapshot. If FALSE, force the live call (errors if it fails). |
A tibble with columns:
Date. Calendar day.
numeric. Pesos per US dollar.
character. Always "trm".
if (interactive()) { trm_2026 <- pulso_trm(start = "2026-01-01", end = "2026-09-30") }if (interactive()) { trm_2026 <- pulso_trm(start = "2026-01-01", end = "2026-09-30") }
DANE publishes a new GEIH month roughly every four weeks, faster than package releases reach CRAN. This downloads the catalog maintained in the pulso repository (refreshed monthly) into the user cache, so new months become loadable without upgrading the package. The catalog is only replaced when the download is valid and covers a later period than the one in use.
pulso_update_catalog( url = "https://raw.githubusercontent.com/Stebandido77/pulso/main/data/sources.json" )pulso_update_catalog( url = "https://raw.githubusercontent.com/Stebandido77/pulso/main/data/sources.json" )
url |
Character. Catalog URL. Defaults to the |
Invisibly, a list with previous_end, latest_end,
n_periods and path (where the catalog was saved, or NULL if it
was not newer).
if (interactive()) { pulso_update_catalog() }if (interactive()) { pulso_update_catalog() }
Returns structured metadata about a specific year-month entry in the pulso registry, including whether it has been manually validated against published DANE figures.
pulso_validation_status(year, month)pulso_validation_status(year, month)
year |
Integer. Year (2007 to current year). |
month |
Integer. Month (1-12). |
A one-row tibble with columns: year, month,
epoch, validated, validated_by,
validated_at, source_url, file_size_mb,
modules_available, checksum_sha256.
pulso_validation_status(2024, 6)pulso_validation_status(2024, 6)