RobertMyles / cepR

Um pacote R para buscar informações sobre CEPs, endereços, bairros e cidades. (An R package for accessing Brazilian postal code data) :email:
https://robertmyles.github.io/cepR/.
Other
28 stars 9 forks source link

Include multi search #8

Closed GiannottiRod closed 4 years ago

GiannottiRod commented 4 years ago

Cria a função busca_multi, que faz a procura por multiplos CEPs, respeitando o intervalo mínimo de 1 segundo entre cada procura, e retorna as informações encontradas em uma tibble. Para que ela funcione pequenas mudanças na função parse.api foram feitas para que as colunas da tibble criada sempre fossem criadas com tipos de variáveis coerentes (similar ao que já se havia feito nas colunas latitude e longitude)

GiannottiRod commented 4 years ago

Thank you,

If you need any more info from me please let me know.

Thanks again for writing this package it has helped me a lot.

On Fri, Sep 18, 2020 at 10:34 AM Robert Myles McDonnell < notifications@github.com> wrote:

@RobertMyles commented on this pull request.

In R/busca_multi.R https://github.com/RobertMyles/cepR/pull/8#discussion_r490952870:

@@ -0,0 +1,20 @@

+#' @title Busca por CEP

+#' @description Busca usando multiplos CEP (search for information using multiple postal code).

+#' @importFrom magrittr %>%

+#' @importFrom magrittr %<>%

+#' @importFrom dplyr add_row

+#' @param lista_ceps lista de CEPs (postal code list).

+#' @param token Token de autorização. Veja http://cepaberto.com/users/register.

+#' @export

+

+busca_multi <- function( lista_ceps = c("01001000", "01001001") , token = NULL ) {

  • CEPS <- parse_api(NA) %>% na.exclude()

  • lista_ceps %<>% as.vector()

  • for (i in lista_ceps) {

Yeah, it works fine for me now, the mistake was on my end. Regarding na.exclude(), I was wondering initially why you would do it that way but it makes perfect sense. I'm just tidying up some small things in the merge and I'll submit the new version to CRAN asap. Thanks for your contribution, Rodrigo!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RobertMyles/cepR/pull/8#discussion_r490952870, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANHEV2A7JP3XZ2FG2EHE6A3SGNOX7ANCNFSM4RLU35SQ .

RobertMyles commented 4 years ago

My pleasure, happy I could help. It's @edumucelli and the CEPAberto project who deserve the real praise!

RobertMyles commented 4 years ago

Ah, one more thing, @GiannottiRod -- would you mind updating the README with an example of busca_multi() whenever you get a chance? Thanks. v0.1.2 has been submitted to CRAN, should be online soon hopefully.

GiannottiRod commented 4 years ago

Just sent another pr updating the README.Rmd I also fixed a small (literally one letter) Portuguese mistake in it.