R/tratadocumento.R

Defines functions trata_cpf

Documented in trata_cpf

#' Correct Brazilian cpf document.
#'
#' \code{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.
#'
#'
#' @param entrada Character or numeric of the document that will be adjusted.
#'
#' @return Entrada adjusted.
#' @import stringr
#'
#' @examples
#'    trata_cpf(52145795)
#' @export
#'
trata_cpf <- function(entrada){
  stringr::str_pad(entrada,11, side = "left", pad = "0")
}

Try the validaRA package in your browser

Any scripts or data that you put into this service are public.

validaRA documentation built on Nov. 17, 2017, 7:13 a.m.