Type: Package
Title: Chilean Rol Unico Tributario
Version: 1.0.4
Author: Mauricio Santelices
Maintainer: Mauricio Santelices <m.santelicesa@gmail.com>
Description: A RUT (Rol Unico Tributario) is an unique and personal identification number implemented in Chile to identify citizens and taxpayers. Rutifier allows to validate if a RUT exist or not and change between the different formats a RUT can have.
License: MIT + file LICENSE
Imports: R.utils
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
NeedsCompilation: no
Packaged: 2020-02-21 19:24:35 UTC; Altera-04
Repository: CRAN
Date/Publication: 2020-03-02 09:50:02 UTC

Calculate verification numer of a RUT

Description

Calculate verification numer of a RUT

Usage

calculate_dv(num)

Arguments

num

RUT to calculate

Value

Expected verification number

Examples

calculate_dv("12345678")

Clear RUT

Description

Removes any character that is not a number, K, k, dot or hyphen

Usage

clear_rut(rut)

Arguments

rut

Character string

Value

Returns a character string without said characters

Examples

clear_rut('12m345.678-9=')

RUT format: Dots and Hyphen (Puntos y guion)

Description

Changes the format of a RUT to dots and hyphen

Usage

rut_complete(rut, uppercase = FALSE)

Arguments

rut

RUT to modify. It must be a character string

uppercase

Defines if the verification number 'k' should be in uppercase (TRUE) or lowercase (FALSE). By default the value is FALSE

Value

Returns a RUT in dots and hyphen format

Examples

rut_complete('123456789')

RUT format: Hyphen without dots (Sin puntos, con guion)

Description

Changes the format of a RUT to hyphen without dots

Usage

rut_hyphen(rut, uppercase = FALSE)

Arguments

rut

RUT to modify. It must be a character string

uppercase

Defines if the verification number 'k' should be in uppercase (TRUE) or lowercase (FALSE). By default the value is FALSE

Value

Returns a RUT in hyphen without dots format

Examples

rut_hyphen('123456789')

RUT format: Without dots and Hyphen (Sin puntos ni guion)

Description

Changes the format of a RUT to not contain dots or hyphen

Usage

rut_simple(rut, uppercase = FALSE)

Arguments

rut

RUT to modify. It must be a character string

uppercase

Defines if the verification number 'k' should be in uppercase (TRUE) or lowercase (FALSE). By default the value is FALSE

Value

Returns a RUT whitout dots and hyphen

Examples

rut_simple('123456789')

Validate RUT

Description

Validates a Chilean RUT. The input must be a character string in one of the following formats: RUT with dots and hyphen (Ex. '12.345.678-9'), RUT without dots but with hyphen (Ex. '12345678-9') or RUT without dots and hyphen (Ex. '123456789')

Usage

validate_rut(rut)

Arguments

rut

Character str

Value

Returs TRUE if RUT is valid, else it will return FALSE

Examples

validate_rut('123456789')
validate_rut('12345678-9')
validate_rut('12.345.678-9')