| Title: | Validate Brazilian Administrative Registers - Valida Documentos |
|---|---|
| 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. |
| Authors: | Gustavo Coelho [aut], Lucas Mation [aut] (ORCID: <https://orcid.org/0000-0002-7461-932X>), Rodrigo Borges [ctb, cre] (ORCID: <https://orcid.org/0000-0003-2076-1424>), Ipea - Institue for Applied Economic Research [cph, fnd] |
| Maintainer: | Rodrigo Borges <[email protected]> |
| License: | GPL-3 |
| Version: | 0.2.1 |
| Built: | 2026-05-28 06:33:26 UTC |
| Source: | https://github.com/ipea/documentosbr |
doc2integer64 returns a Brazilian document without special characters and as an integer64.
doc2integer64(entrada)doc2integer64(entrada)
entrada |
Character or numeric that will be converted. |
an bit64 integer
doc2integer64("086.090.705-65")doc2integer64("086.090.705-65")
gera_digito generate the last digit of a administrative register.
gera_digito(entrada, type = "cpf")gera_digito(entrada, type = "cpf")
entrada |
Character or numeric of the document that will be validated. |
type |
Character, it could be CPF, CNPF, PIS e titulo de eleitor. |
it will alter the number by reference.
gera_digito("529.982.247-2", type = "cpf") gera_digito("60.149.443/0001-7", type = "cnpj")gera_digito("529.982.247-2", type = "cpf") gera_digito("60.149.443/0001-7", type = "cnpj")
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.
trata_cpf(entrada)trata_cpf(entrada)
entrada |
Character or numeric of the document that will be adjusted. |
Entrada adjusted.
trata_cpf(52145795)trata_cpf(52145795)
valida_doc returns true or false if the number of document is correct.
valida_doc(entrada, type = "cpf", log = FALSE)valida_doc(entrada, type = "cpf", log = FALSE)
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 |
True or False. if log is giving return a data frame.
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")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")
valida_doc_df returns true or false if the number of document is correct.
valida_doc_df(data, column, type = "cpf", log = FALSE)valida_doc_df(data, column, type = "cpf", log = FALSE)
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 |
True or False. if log is giving return a data frame.
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).
verificar_titulo_eleitor(entrada, log = FALSE)verificar_titulo_eleitor(entrada, log = FALSE)
entrada |
Um |
log |
|
Retorna um valor lógico: TRUE se o título for válido,
FALSE caso contrário.
# 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")# 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")