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". Seefa_surveys().- level
"unit"(ENA agricultural unit, ENAHO household) or"person"(ENAHO only).
Detalles
ENA (
level = "unit"): district, cluster, producer and agricultural unit. The cluster isCONGLOMERADOup to 2022 andNSEGMfrom 2023; the producer isNSELUAup to 2022 andID_PRODfrom 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 withlevel = "person"(addsCODPERSO).
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"
