Ir al contenido

Builds one text key per row, the same in every round even where INEI renamed the identifiers, so that modules of the same round can be joined with merge().

Uso

fa_key(data, survey, level = c("unit", "person"))

Argumentos

data

A data frame from fa_read() with the identifier columns.

survey

Short name, for example "enaho". See fa_surveys().

level

"unit" (ENA agricultural unit, ENAHO household) or "person" (ENAHO only).

Valor

A character vector with one key per row.

Detalles

  • ENA (level = "unit"): district, cluster, producer and agricultural unit. The cluster is CONGLOMERADO up to 2022 and NSEGM from 2023; the producer is NSELUA up to 2022 and ID_PROD from 2023. With this key, chapters such as 400B and 500AB join in full in every round from 2014 to 2025.

  • ENAHO: the household (CONGLOME, VIVIENDA, HOGAR), or the person with level = "person" (adds CODPERSO).

Keys identify units within one round only. The ENA is a repeated cross section, not a panel: the same key in two years is not the same farm. Compare rounds by area with fa_link().

Ejemplos

ena <- data.frame(CCDD = "01", CCPP = "01", CCDI = "02", NSEGM = "7003",
                  ID_PROD = "1", UA = "1")
fa_key(ena, "ena")
#> [1] "010102-7003-1-1"
hog <- data.frame(conglome = "015009", vivienda = "013", hogar = "11", codperso = "01")
fa_key(hog, "enaho", level = "person")
#> [1] "015009-013-11-01"