| Type: | Package |
| Title: | Validate Brazilian Administrative Registers - Valida Documentos |
| Version: | 0.1.8 |
| Maintainer: | Rodrigo Borges <rodrigo.borges@ipea.gov.br> |
| Description: | Contains functions to validate administrative register as CPF (Cadastro de Pessoa Fisica), CNPJ (Cadastro de Pessoa Juridica), PIS (Programa de Integracao Social), CNES (Cadastro Nacional de Saude). Builds from and improves on previous package from IPEA validaRA https://github.com/ipea/validaRA. It can check individual registers or help creating a table summarizing validity of a set. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| URL: | https://github.com/ipea/documentosbr |
| BugReports: | https://github.com/ipea/documentosbr/issues |
| Suggests: | testthat, knitr, covr, rmarkdown |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 3.0) |
| LinkingTo: | Rcpp, BH |
| Imports: | Rcpp, bit64, stringr, data.table |
| VignetteBuilder: | knitr |
| NeedsCompilation: | yes |
| Packaged: | 2026-03-31 22:04:20 UTC; borges |
| Author: | Gustavo Coelho [aut],
Lucas Mation |
| Repository: | CRAN |
| Date/Publication: | 2026-04-27 14:30:09 UTC |
Convert Brazilian documents.
Description
doc2integer64 returns a Brazilian document without special characters and as an integer64.
Usage
doc2integer64(entrada)
Arguments
entrada |
Character or numeric that will be converted. |
Value
an bit64 integer
Examples
doc2integer64("086.090.705-65")
Complete Brazilian documents.
Description
gera_digito generate the last digit of a administrative register.
Usage
gera_digito(entrada, type = "cpf")
Arguments
entrada |
Character or numeric of the document that will be validated. |
type |
Character, it could be CPF, CNPF, PIS e titulo de eleitor. |
Value
it will alter the number by reference.
Examples
gera_digito("529.982.247-2", type = "cpf")
gera_digito("60.149.443/0001-7", type = "cnpj")
Correct Brazilian cpf document.
Description
trada_cpf The aim is transform the entrada to the pattern of Brazilian document cpf.
It must have 11 numeric characters. When a dataset is read as a numeric,
it lost the 0 character on the left. This function fix that lost and transform
entrada to character.
Usage
trata_cpf(entrada)
Arguments
entrada |
Character or numeric of the document that will be adjusted. |
Value
Entrada adjusted.
Examples
trata_cpf(52145795)
Check Brazilian documents.
Description
valida_doc returns true or false if the number of document is correct.
Usage
valida_doc(entrada, type = "cpf", log = FALSE)
Arguments
entrada |
Character or numeric of the document that will be validated. |
type |
Character, it could be CPF, CNPJ, PIS e titulo de eleitor. |
log |
Output errs found on entrada |
Value
True or False. if log is giving return a data frame.
Examples
valida_doc("529.982.247-25", type = "cpf")
valida_doc("529.982.247-25", type = "pis")
valida_doc("529.982.247-25", type = "cnes")
valida_doc("60.149.443/0001-70", type = "cnpj")
Check Brazilian documents.
Description
valida_doc_df returns true or false if the number of document is correct.
Usage
valida_doc_df(data, column, type = "cpf", log = FALSE)
Arguments
data |
Data frame with data to be validate. |
column |
Column of data that will be evaluated. |
type |
Character, it could be CPF, CNPJ, PIS e titulo de eleitor. |
log |
Output errs found on entrada |
Value
True or False. if log is giving return a data frame.
Validar Título de Eleitor
Description
Verifica se um número de Título de Eleitor é válido utilizando o algoritmo de dígito verificador baseado em pesos e restos de divisão (módulo 11).
Usage
verificar_titulo_eleitor(entrada, log = FALSE)
Arguments
entrada |
Um |
log |
|
Value
Retorna um valor lógico: TRUE se o título for válido,
FALSE caso contrário.
Examples
# Exemplo com título válido (formato string)
verificar_titulo_eleitor("293116340175")
# Exemplo com título válido (formato numérico)
verificar_titulo_eleitor(293116340175)
# Exemplo com título inválido
verificar_titulo_eleitor("123456789012")