Skip to content

Commit

Permalink
reduce tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caropradier committed Jun 20, 2024
1 parent 0ac4f95 commit e189116
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 49 deletions.
78 changes: 39 additions & 39 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
Tasa_indigencia = sum(PONDIH[situacion == 'indigente'],na.rm = TRUE)/
sum(PONDIH,na.rm = TRUE))
}
else {
Pobreza_resumen <- base %>%
dplyr::mutate(SEMESTRE = ifelse(TRIMESTRE %in% c(1,2),yes = 1,no = 2)) %>%
dplyr::group_by(ANO4,SEMESTRE,dplyr::across(c({{group_vars}}))) %>%
dplyr::summarise(Tasa_pobreza = sum(PONDIH[situacion %in% c('pobre', 'indigente')],na.rm = TRUE)/
sum(PONDIH,na.rm = TRUE),
Tasa_indigencia = sum(PONDIH[situacion == 'indigente'],na.rm = TRUE)/
sum(PONDIH,na.rm = TRUE))
}
print(Pobreza_resumen)
}
return(Pobreza_resumen)
}
bases <- dplyr::bind_rows(toybase_individual_2016_03,
toybase_individual_2016_04)
resultado <- calculate_poverty(base = bases,
basket = canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
canastas_reg_example
canastas_reg_example = canastas_reg_example
resultado <- calculate_poverty(base = bases,
basket = canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
bases <- dplyr::bind_rows(toybase_individual_2016_03,
toybase_individual_2016_04)
resultado <- calculate_poverty(base = bases,
basket = canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
calculate_poverty <- function(base,basket,group_vars,print_summary=TRUE,window = "quarter"){
base <- base %>%
dplyr::mutate(periodo = paste(ANO4, TRIMESTRE, sep='.')) %>%
dplyr::left_join(., adulto_equivalente, by = c("CH04", "CH06")) %>%
dplyr::left_join(., basket, by = c('REGION'="codigo", "periodo")) %>%
Expand Down Expand Up @@ -510,3 +471,42 @@ usethis::use_version(which = "patch")
devtools::document()
codemetar::write_codemeta()
devtools::submit_cran()
test_that("total urbano descarga", {
skip_if_offline()
skip_on_cran()
df <- get_total_urbano(year = 2016, type = "individual", vars = "all")
dimensiones <- dim(df)
expect_equal(dimensiones, c(95782, 152))
})
devtools::load_all()
test_that("total urbano descarga", {
skip_if_offline()
skip_on_cran()
df <- get_total_urbano(year = 2016, type = "individual", vars = "all")
dimensiones <- dim(df)
expect_equal(dimensiones, c(95782, 152))
})
test_that("selec variables", {
skip_if_offline()
skip_on_cran()
df <- get_total_urbano(year = 2016, type = "individual", vars = c("CODUSU", "CH04", "CH06", "PONDERA"))
dimensiones <- dim(df)
expect_equal(dimensiones, c(95782, 4))
})
test_that("antes de 2016", {
skip_if_offline()
skip_on_cran()
expect_warning(df <- get_total_urbano(year = 2009, type = "individual"))
})
test_that("errores", {
expect_warning(df <- get_total_urbano(year = 2016, type = "individu"))
})
test_that("errores", {
expect_warning(df <- get_total_urbano(year = 2016, type = "individu"))
})
get_total_urbano(year = 2016, type = "individu")
get_total_urbano(year = 2009, type = "individual")
devtools::check_win_devel()
devtools::check()
devtools::document()
devtools::submit_cran()
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.0.2
Date: 2024-06-20 13:20:56 UTC
SHA: fece02fc19aaf242e9559354e89d3eead666090b
Date: 2024-06-20 14:25:47 UTC
SHA: 0ac4f95ca9aa4e4a937cfd06d0605694286a62aa
8 changes: 0 additions & 8 deletions tests/testthat/test-get_total_urbano.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
test_that("total urbano descarga", {
skip_if_offline()
skip_on_cran()
df <- get_total_urbano(year = 2016, type = "individual", vars = "all")
dimensiones <- dim(df)
expect_equal(dimensiones, c(95782, 152))
})

test_that("selec variables", {
skip_if_offline()
skip_on_cran()
Expand Down

0 comments on commit e189116

Please sign in to comment.