Skip to content

Commit

Permalink
consertando tipos de logradouro
Browse files Browse the repository at this point in the history
  • Loading branch information
dhersz committed Oct 15, 2024
1 parent bb9f798 commit 82bca62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/padronizar_tipos_de_logradouro.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ padronizar_tipos_de_logradouro <- function(tipos) {
r"{"}" = "'", # existem ocorrencias em que aspas duplas sao usadas para se referir a um logradouro/quadra com nome relativamente ambiguo - e.g. RUA \"A\", 26. isso pode causar um problema quando lido com o data.table: https://github.com/Rdatatable/data.table/issues/4779. por enquanto, substituindo por aspas simples. depois a gente pode ver o que fazer com as aspas simples rs.
# valores non-sense
r"{^(X|-)+$}" = "", # - --+
r"{^-+$}" = "", # - --+
r"{^([^\d])\1{1,}$}" = "", # qualquer valor não numérico 2+ vezes
r"{^\d+$}" = "", # tipos de logradouro não podem ser números
# ordenacao de logradouros - e.g. 3A RUA, 15A TRAVESSA, 1A RODOVIA, 1O BECO, etc
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-padronizar_tipos_de_logradouro.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ test_that("padroniza corretamente", {
"RUA - UM", "RUA UM",
"RUA . UM", "RUA UM",
"RUA.", "RUA",

"\"", "'",

"AA", NA_character_,
"AAAAAA", NA_character_,
"1", NA_character_,
Expand Down

0 comments on commit 82bca62

Please sign in to comment.