Skip to content

Commit

Permalink
Convert code_dept to character
Browse files Browse the repository at this point in the history
to use startsWith() and later, substr()
  • Loading branch information
Bisaloo committed Nov 8, 2023
1 parent ba81b50 commit dc4f33e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ obtener_info_depts <- function(dpto = NULL, munpio = NULL) {
#' @export
modficar_cod_mun <- function(code_dept, cod_mun) {
cod_mun <- as.character(cod_mun)
code_dept <- as.character(code_dept)
if (startsWith(code_dept, "0")) {
code_dept <- substr(code_dept, 2, 2)
cod_mun <- gsub(code_dept, "", cod_mun)
Expand Down Expand Up @@ -273,6 +274,7 @@ obtener_dptos <- function() {
#' cod_mun = "001")
#' @export
obtener_nombres_muns <- function(data_geo, code_dept, cod_mun) {
code_dept <- as.character(code_dept)
if (startsWith(code_dept, "0")) {
code_dept <- substr(code_dept, 2, 2)
cod_mun <- paste0(code_dept, cod_mun)
Expand Down

0 comments on commit dc4f33e

Please sign in to comment.