Puts side by side estimate tables from different surveys (from
fa_estimate() or fa_indicator()) for the same departments or
districts. District codes are first moved to the 2017 Census frame
with fa_ubigeo(), so a district created after 2017 lines up
with the district it came from.
Uso
fa_link(
...,
level = c("department", "district"),
base = 2017,
by_year = NULL,
all = FALSE
)Argumentos
- ...
Estimate tables, named: the names become column suffixes, e.g.
fa_link(poverty = p, women = w).- level
"department"or"district". Each table must have been estimated at that level.- base
Census year of the district frame (2017).
- by_year
Join on year as well. By default, only when every table has a
yearcolumn (fa_indicator() adds it); tables from fa_estimate() are joined by area alone. Set toFALSEto cross different years on purpose.- all
Keep areas that are missing in some tables (
TRUE) or only those present in all (FALSE).
Valor
A data frame with the key (department or ubigeo_base), its
name, year when joined by year, and for each table the columns
estimate_<name>, se_<name>, cv_<name>, quality_<name> and
n_<name> (plus status_<name> for districts), of class fa_link
(see estimate-methods).
Detalles
Warns when a table has estimates with CV above 15% ("referencial" for INEI), when a district split from several 2017 districts ("multi_parent") and cannot be placed, and when several districts fall on the same 2017 district: then the estimate of the 2017 district itself is kept, because survey estimates of different areas cannot be added without their totals.
Ejemplos
a <- data.frame(by = "department", domain = c("01", "02"), estimate = c(.3, .4),
se = .01, cv = c(3, 2.5), n = 100, quality = "muy buena", year = 2024)
b <- transform(a, estimate = c(.5, .6))
fa_link(poverty = a, other = b)
#> <faperu link: poverty + other by department, 2 areas>
#> department year name estimate_poverty se_poverty cv_poverty
#> 01 2024 Amazonas 0.3 0.01 3.0
#> 02 2024 Ancash 0.4 0.01 2.5
#> quality_poverty n_poverty estimate_other se_other cv_other quality_other
#> muy buena 100 0.5 0.01 3.0 muy buena
#> muy buena 100 0.6 0.01 2.5 muy buena
#> n_other
#> 100
#> 100
