test_that("get_estimation_mean works", {
df = ech::toy_ech_2018
a <- get_estimation_mean(data = df, variable = "pobre06", level = "h", name = "hogares_pobre_mean")
expect_equal(nrow(a), 2)
a <- get_estimation_mean(data = df, variable = "pobre06", domain = "dpto == 1", level = "h")
expect_equal(nrow(a), 2)
a <- get_estimation_mean(data = df, variable = "pobre06", by.x = "mes", domain = "dpto == 1", level = "h")
expect_equal(nrow(a), 18)
a <- get_estimation_mean(data = df, variable = "pobre06", by.x = "region_4", level = "h")
expect_equal(nrow(a), 8)
a <- get_estimation_mean(data = df, variable = "pobre06", by.x = "dpto", by.y = "e26", level = "h")
expect_equal(nrow(a), 49)
a <- get_estimation_mean(data = df, variable = "pobre06", by.x = "e26", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 35)
b <- get_estimation_mean(data = df, variable = "ht11", level = "h", name = "hogares_pobre_mean")
expect_equal(nrow(b), 1)
b <- get_estimation_mean(data = df, variable = "ht11", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 1)
b <- get_estimation_mean(data = df, variable = "ht11", by.x = "mes", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 12)
b <- get_estimation_mean(data = df, variable = "ht11", by.x = "dpto", level = "h")
expect_equal(nrow(b), 19)
b <- get_estimation_mean(data = df, variable = "ht11", by.x = "dpto", by.y = "mes", level = "h")
expect_equal(nrow(b), 149)
b <- get_estimation_mean(data = df, variable = "ht11", by.x = "secc", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(b), 117)
c <- get_estimation_mean(data = df, variable = "pobre06", pesoano = "pesoano", level = "h", ids = "upm_id", estrato = "estrato")
expect_equal(nrow(c), 2)
})
test_that("get_estimation_total works", {
df = ech::toy_ech_2018
a <- get_estimation_total(data = df, variable = "pobre06", level = "h", name = "hogares_pobre_total")
expect_equal(nrow(a), 2)
a <- get_estimation_total(data = df, variable = "pobre06", domain = "dpto == 1", level = "h")
expect_equal(nrow(a), 2)
a <- get_estimation_total(data = df, variable = "pobre06", by.x = "mes", domain = "dpto == 1", level = "h")
expect_equal(nrow(a), 18)
a <- get_estimation_total(data = df, variable = "pobre06", by.x = "dpto", level = "h")
expect_equal(nrow(a), 26)
a <- get_estimation_total(data = df, variable = "pobre06", by.x = "dpto", by.y = "e26", level = "h")
expect_equal(nrow(a), 49)
a <- get_estimation_total(variable = "pobre06", by.x = "secc", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 123)
c <- get_estimation_total(data = df, variable = "pobre06", pesoano = "pesoano", level = "h", ids = "upm_id", estrato = "estrato")
expect_equal(nrow(c), 2)
b <- get_estimation_total(data = df, variable = "ht11", level = "h", name = "hogares_pobre_total")
expect_equal(nrow(b), 1)
b <- get_estimation_total(data = df, variable = "ht11", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 1)
b <- get_estimation_total(data = df, variable = "ht11", by.x = "mes", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 12)
b <- get_estimation_total(data = df, variable = "ht11", by.x = "dpto", level = "h")
expect_equal(nrow(b), 19)
b <- get_estimation_total(data = df, variable = "ht11", by.x = "dpto", by.y = "mes", level = "h")
expect_equal(nrow(b), 149)
b <- get_estimation_total(data = df, variable = "ht11", by.x = "secc", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(b), 117)
df <- housing_situation(data = ech::toy_ech_2018)
b <- get_estimation_total(data = df, variable = "housing_situation", level = "h", name = "hogares_pobre_total")
expect_equal(nrow(b), 4)
b <- get_estimation_total(data = df, variable = "housing_situation", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 4)
b <- get_estimation_total(data = df, variable = "housing_situation", by.x = "mes", domain = "dpto == 1", level = "h")
expect_equal(nrow(b), 39)
b <- get_estimation_total(data = df, variable = "housing_situation", by.x = "dpto", level = "h")
expect_equal(nrow(b), 54)
b <- get_estimation_total(data = df, variable = "housing_situation", by.x = "dpto", by.y = "mes", level = "h")
expect_equal(nrow(b), 248)
b <- get_estimation_total(data = df, variable = "housing_situation", by.x = "secc", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(b), 155)
})
test_that("get_estimation_ratio works", {
ech_2018 <- employment(data = ech::toy_ech_2018, pobpcoac = "pobpcoac")
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", level = "i", name = "tasa_ocupacion")
expect_equal(nrow(a), 1)
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 1)
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", domain = "dpto == 1", by.x = "mes", level = "i")
expect_equal(nrow(a), 12)
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", by.x = "dpto", level = "i")
expect_equal(nrow(a), 19)
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", by.x = "dpto", by.y = "mes",level = "i")
expect_equal(nrow(a), 149)
a <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", by.x = "secc", by.y = "mes", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 117)
c <- get_estimation_ratio(data = ech_2018, variable.x = "pd", variable.y = "pea", level = "h", ids = "upm_id", estrato = "estrato")
expect_equal(nrow(c), 1)
})
test_that("get_estimation_median works", {
ech_2018 <- ech::toy_ech_2018
a <- get_estimation_median(data = ech_2018, variable = "ht11", level = "i")
expect_equal(nrow(a), 1)
a <- get_estimation_median(data = ech_2018, variable = "ht11", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 1)
a <- get_estimation_median(data = ech_2018, variable = "ht11", domain = "dpto == 1", by.x = "e26", level = "i")
expect_equal(nrow(a), 2)
a <- get_estimation_median(data = ech_2018, variable = "ht11", by.x = "dpto", level = "i")
expect_equal(nrow(a), 19)
a <- get_estimation_median(data = ech_2018, variable = "ht11", by.x = "region_4", by.y = "e26", level = "h")
expect_equal(nrow(a), 8)
a <- get_estimation_median(data = ech_2018, variable = "ht11", by.x = "region_4", by.y = "e26", domain = "dpto == 1", level = "i")
expect_equal(nrow(a), 2)
expect_error(get_estimation_median(data = ech_2018, variable = "pobre06", level = "i"))
c <- get_estimation_median(data = ech_2018, variable = "ht11", pesoano = "pesoano", level = "h", ids = "upm_id", estrato = "estrato")
expect_equal(nrow(c), 1)
})
test_that("get_estimation_gini works", {
ech_2018 <- income_constant_prices(data = ech::toy_ech_2018, level = "R",
index = "IPC", base_month = "01", base_year = "2005")
a <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "h")
expect_is(a, "data.frame")
b <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "h", by = "nomdpto")
expect_is(b, "data.frame")
a <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i")
expect_is(a, "data.frame")
a <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", by = NULL, bootstrap = TRUE, ids = NULL)
expect_is(a, "data.frame")
b <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", by = "nomdpto")
expect_is(b, "data.frame")
b <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", by = "nomdpto", bootstrap = TRUE, ids = NULL)
expect_is(b, "data.frame")
a <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", ids = "upm_id", estrato = "estrato")
expect_is(a, "data.frame")
b <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", by = "nomdpto", ids = "upm_id", estrato = "estrato")
expect_is(b, "data.frame")
a <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i", ids = "upm_id", estrato = "estrato", bootstrap = T, r = 5)
expect_is(a, "data.frame")
b <- get_estimation_gini(data = ech_2018, variable = "y_wrv_pc_d_r", level = "i",
by = "nomdpto", ids = "upm_id", estrato = "estrato", bootstrap = T, r = 5)
expect_is(b, "data.frame")
})
test_that("get_estimation_gpg works", {
toy_ech_2018 <- labor_income_per_hour(data = ech::toy_ech_2018, base_month = 6, base_year = 2018)
a <- get_estimation_gpg(data = toy_ech_2018, variable = "total_income_per_hour", e26 = "e26")
expect_is(a, "data.frame")
b <- get_estimation_gpg(data = toy_ech_2018, variable = "total_income_per_hour", e26 = "e26", by = "nomdpto")
expect_is(b, "data.frame")
c <- get_estimation_gpg(data = toy_ech_2018, variable = "total_income_per_hour", e26 = "e26", by = "nomdpto", ids = "upm_id", estrato = "estrato")
expect_is(c, "data.frame")
d <- get_estimation_gpg(data = toy_ech_2018, variable = "total_income_per_hour", e26 = "e26", ids = "upm_id", estrato = "estrato")
expect_is(d, "data.frame")
})
test_that("get_estimation_qsr works", {
ech_2018 <- income_constant_prices(data = ech::toy_ech_2018, level = "R",
index = "IPC", base_month = "01", base_year = "2005")
a <- get_estimation_qsr(data = ech_2018, variable = "y_wrv_pc_d_r", pesoano = "pesoano")
expect_is(a, "data.frame")
b <- get_estimation_qsr(ech_2018, variable = "y_wrv_pc_d_r", pesoano = "pesoano")
expect_is(b, "data.frame")
c <- get_estimation_qsr(ech_2018, variable = "y_wrv_pc_d_r", pesoano = "pesoano", by ="region_4")
expect_is(c, "data.frame")
d <- get_estimation_qsr(ech_2018, variable = "y_wrv_pc_d_r", pesoano = "pesoano", ids = "upm_id", estrato = "estrato")
expect_is(d, "data.frame")
e <- get_estimation_qsr(ech_2018, variable = "y_wrv_pc_d_r", pesoano = "pesoano", by ="region_4", ids = "upm_id", estrato = "estrato")
expect_is(e, "data.frame")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.