Skip to content

Commit

Permalink
better adjust to CRAN policies
Browse files Browse the repository at this point in the history
  • Loading branch information
caropradier committed Jun 20, 2024
1 parent b557dbc commit d686688
Show file tree
Hide file tree
Showing 48 changed files with 300 additions and 285 deletions.
182 changes: 91 additions & 91 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -1,94 +1,3 @@
base <- dplyr::bind_rows(toybase_individual_2016_03,
toybase_individual_2016_04)
bases <- dplyr::bind_rows(toybase_individual_2016_03,
toybase_individual_2016_04)
bases <- dplyr::bind_rows(toybase_individual_2016_03,
toybase_individual_2016_04)
resultado <-
bases %>%
calculate_poverty(basket = canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
resultado <-
bases %>%
calculate_poverty(basket = eph::canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
canastas_reg_example
resultado <-
bases %>%
calculate_poverty(basket = canastas_reg_example,
group_vars = c(CH04,NIVEL_ED),
window = "semestral",
print_summary=TRUE)
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")) %>%
dplyr::group_by(CODUSU, NRO_HOGAR, periodo) %>%
dplyr::mutate(adequi_hogar = sum(adequi)) %>%
dplyr::ungroup() %>%
dplyr::mutate(CBA_hogar = CBA*adequi_hogar,
CBT_hogar = CBT*adequi_hogar,
situacion = dplyr::case_when(ITF<CBA_hogar ~ 'indigente',
ITF>=CBA_hogar & ITF<CBT_hogar ~ 'pobre',
ITF>=CBT_hogar ~ 'no_pobre'),
situacion = dplyr::case_when(PONDIH==0 ~ NA_character_, #excluyo los casos que no tienen respuesta en ITF
TRUE ~ situacion)) %>%
dplyr::select(-adequi,-periodo,-CBA, -CBT)
if (print_summary) {
if(window == "quarter"){
Pobreza_resumen <- base %>%
dplyr::group_by(ANO4,TRIMESTRE) %>%
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))
}
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)
}
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")) %>%
dplyr::group_by(CODUSU, NRO_HOGAR, periodo) %>%
dplyr::mutate(adequi_hogar = sum(adequi)) %>%
dplyr::ungroup() %>%
dplyr::mutate(CBA_hogar = CBA*adequi_hogar,
CBT_hogar = CBT*adequi_hogar,
situacion = dplyr::case_when(ITF<CBA_hogar ~ 'indigente',
ITF>=CBA_hogar & ITF<CBT_hogar ~ 'pobre',
ITF>=CBT_hogar ~ 'no_pobre'),
situacion = dplyr::case_when(PONDIH==0 ~ NA_character_, #excluyo los casos que no tienen respuesta en ITF
TRUE ~ situacion)) %>%
dplyr::select(-adequi,-periodo,-CBA, -CBT)
if (print_summary) {
if(window == "quarter"){
Pobreza_resumen <- base %>%
dplyr::group_by(ANO4,TRIMESTRE) %>%
dplyr::summarise(Tasa_pobreza = sum(PONDIH[situacion %in% c('pobre', 'indigente')],na.rm = TRUE)/
Expand Down Expand Up @@ -510,3 +419,94 @@ devtools::build_vignettes()
devtools::build_vignettes()
devtools::build_vignettes()
pkgdown::build_site()
pkgbuild::check_build_tools(debug = TRUE)
?usethis::use_version
usethis::use_version(which = "patch")
devtools::load_all()
test_base <- get_microdata(2023,1,"individual")
test_base <- test_base %>% organize_labels()
test_base$REGION
calculate_tabulates(test_base,"REGION")
usethis::use_version(which = "patch")
devtools::document()
devtools::check()
devtools::check_rhub()
devtools::check_rhub()
install.packages("curl")
devtools::check_rhub()
devtools::check_rhub()
httr::set_config(httr::config(ssl_verifypeer = 0L))
devtools::check_rhub()
httr::set_config( config( ssl.verifypeer = 0L ) )
httr::set_config(httr::config(ssl.verifypeer = 0L))
devtools::check_rhub()
httr::set_config(httr::config(ssl_verifypeer = 0L))
devtools::check_rhub()
install.packages("curl")
install.packages("httr")
devtools::check_rhub()
options(ssl.verifypeer = NULL)
devtools::check_rhub()
?curl::handle_setopt
httr::set_config(httr::config(ssl.verifypeer = NULL))
devtools::check_rhub()
?handle_reset
handle_reset()
curl::handle_reset()
remove.packages("curl")
remove.packages("httr")
installed.packages("curl")
installed.packages("httr")
library(curl)
install.packages("curl")
install.packages("httr")
devtools::check_rhub()
install.packages("devtools")
install.packages("rhub")
install.packages("devtools")
devtools::check_rhub()
?rhubv2
rhub_setup()
rhub::rhub_setup()
rhub::rhub_check()
?rhub::rhub_platforms()
devtools::check_rhub()
devtools::check_rhub()
devtools::check_rhub()
rhub::rhub_check()
rhub::rhub_check()
rhub::rhub_check(platforms = c("1","3","5"))
rhub::rhub_check(platforms = c("linux","macos-arm64","windows"))
devtools::check_win_devel()
codemetar::write_codemeta()
rhub::validate_email()
rhub::platforms()
rhub::rhub_platforms()
rhub::rhub_check(platforms = c("linux","macos-arm64","windows"))
rhub::rhub_check(platforms = c("linux", "macos-arm64", "windows"), verbose = TRUE)
?rhub::rhub_check
document()
devtools::document()
devtools::document()
devtools::build_readme()
devtools::build_readme()
devtools::build_readme()
devtools::check_win_devel()
devtools::submit_cran()
devtools::submit_cran()
pkgdown::build_site()
library(blogdown)
eph::get_poverty_lines()
devtools::load_all()
get_poverty_lines()
devtools::load_all()
get_poverty_lines()
devtools::document()
devtools::check()
desc_del_dep('attempt')
desc::desc_del_dep('attempt')
devtools::document()
devtools::check()
devtools::check_win_devel()
codemetar::write_codemeta()
devtools::submit_cran()
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.0.0
Date: 2023-09-15 14:23:51 UTC
SHA: 47d92f67bd8105c5062c83b145f4e66119cf89e8
Version: 1.0.1
Date: 2024-06-20 12:38:26 UTC
SHA: b557dbcc8d9a60cf8a1790982cc0fbd4787f9b05
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Imports:
readxl,
tidyr,
utils,
attempt,
zoo,
leaflet,
htmltools,
Expand Down
12 changes: 8 additions & 4 deletions R/get_eahu.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ get_eahu <- function(year = 2010,


if (is.null(destfile) | !destfile_exists) {
attempt::stop_if_not(
.x = curl::has_internet(),
msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
)
# attempt::stop_if_not(
# .x = curl::has_internet(),
# msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
# )
if (!curl::has_internet()) { # network is down = message (not an error anymore)
message("No se detecto acceso a internet. Por favor checkea tu conexion.")
return(NULL)
}

df <- tibble::as_tibble(expand.grid(
year = year,
Expand Down
12 changes: 8 additions & 4 deletions R/get_microdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ get_microdata <- function(year = 2018,


if (is.null(destfile) | !destfile_exists) {
attempt::stop_if_not(
.x = curl::has_internet(),
msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
)
# attempt::stop_if_not(
# .x = curl::has_internet(),
# msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
# )
if (!curl::has_internet()) { # network is down = message (not an error anymore)
message("No se detecto acceso a internet. Por favor checkea tu conexion.")
return(NULL)
}

df <- tibble::as_tibble(expand.grid(
year = year,
Expand Down
12 changes: 8 additions & 4 deletions R/get_poverty_lines.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
#' @export

get_poverty_lines <- function(regional = FALSE) {
attempt::stop_if_not(
.x = curl::has_internet(),
msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
)
# attempt::stop_if_not(
# .x = curl::has_internet(),
# msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
# )
if (!curl::has_internet()) { # network is down = message (not an error anymore)
message("No se detecto acceso a internet. Por favor checkea tu conexion.")
return(NULL)
}

if (regional) {
temp <- tempfile()
Expand Down
12 changes: 8 additions & 4 deletions R/get_total_urbano.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ get_total_urbano <- function(year = 2016,


if (is.null(destfile) | !destfile_exists) {
attempt::stop_if_not(
.x = curl::has_internet(),
msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
)
# attempt::stop_if_not(
# .x = curl::has_internet(),
# msg = "No se detecto acceso a internet. Por favor checkea tu conexion."
# )
if (!curl::has_internet()) { # network is down = message (not an error anymore)
message("No se detecto acceso a internet. Por favor checkea tu conexion.")
return(NULL)
}

df <- tibble::as_tibble(expand.grid(
year = year,
Expand Down
Loading

0 comments on commit d686688

Please sign in to comment.