diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:42:37 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 12:42:37 -0300 |
| commit | 11d49bc25eb1643f1b742f9527212d8781f2e0de (patch) | |
| tree | bae1cb090cbf6c9f82ab5abbaf1194206f92f539 /man/cep_lookup_many.Rd | |
| download | r-11d49bc25eb1643f1b742f9527212d8781f2e0de.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'man/cep_lookup_many.Rd')
| -rw-r--r-- | man/cep_lookup_many.Rd | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/man/cep_lookup_many.Rd b/man/cep_lookup_many.Rd new file mode 100644 index 0000000..9362649 --- /dev/null +++ b/man/cep_lookup_many.Rd @@ -0,0 +1,51 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/api.R +\name{cep_lookup_many} +\alias{cep_lookup_many} +\title{Look up many CEPs in one request} +\usage{ +cep_lookup_many(ceps, client = default_client()) +} +\arguments{ +\item{ceps}{A character vector of CEPs, masked or unmasked.} + +\item{client}{A \code{\link[=cepis_client]{cepis_client()}}. Defaults to a shared client built with +the default configuration.} +} +\value{ +A list of \strong{the same length and in the same order} as \code{ceps}. +Each element is a \link{cepis_address}, or \code{NULL} where the CEP does not +exist or is malformed — it does not vanish from the list, and it does not +signal a condition. That is the right difference from \code{\link[=cep_lookup]{cep_lookup()}}: in +a batch of a thousand, one bad CEP must not cost the other nine hundred +and ninety-nine. Use \code{\link[=normalize_cep]{normalize_cep()}} beforehand if you need to know +\emph{which} input was malformed. + +A list rather than a \code{data.frame} because \code{NULL} is the only unambiguous +"no such CEP" in R: a row of \code{NA}s reads as an address with unknown +fields, which is a different statement, and an empty row cannot be told +apart from a CEP the database knows only by number. Rectangle it with +\code{do.call(rbind, lapply(result, function(a) as.data.frame(a[1:13])))} when +a \code{data.frame} is what you want. +} +\description{ +Resolves up to 500 CEPs per request, chunking longer inputs automatically. +Do not loop over \code{\link[=cep_lookup]{cep_lookup()}}: a loop of 500 calls pays 500 TLS +handshakes, the batch pays one. +} +\section{Batches carry no coordinate}{ + +The endpoint behind them is CSV, and the CSV has no \code{geo} column. Every +address returned here has \code{geo = NULL}, including for CEPs that do have +one. Need \code{geo}? Use \code{\link[=cep_lookup]{cep_lookup()}}, one at a time. +} + +\examples{ +\donttest{ +ceps <- c("01001000", "99999999", "20040020") +result <- cep_lookup_many(ceps) +vapply(result, function(a) if (is.null(a)) NA_character_ else a$localidade, + character(1)) +} + +} |