Learn R Programming

abjutils

Visão Geral

{abjutils} is a toolkit with some useful functions created by the Brazilian Jurimetrics Association (Associação Brasileira de Jurimetria).

Most functions help with identifying lawsuit IDs as specified by the National Justice Council (Conselho Nacional de Justiça): NNNNNNN-DD.AAAA.J.TR.OOOO. The rest helps with ASCII and other formatting problems.

Installation

You can install the most recent version of {abjutils} with:

# CRAN
install.packages("abjutils")

# GitHub (dev)
install.packages("remotes")
remotes::install_github("abjur/abjutils")

Functions

FunctionDescription
build_id()Add separators to ID
calc_dig()Calculate verification digit of an ID
carf_build_id()Add digits to CARF ID
carf_calc_dig()Calculate verification digit of a CARF ID
carf_check_dig()Check digits of a CARF ID
check_dig()Check digits of an ID
check_dig_vet()Check a verification digit vector
chrome_to_body()Convert POST parameters to a list
clean_cnj()Remove non-numeric characters from a string
clean_id()Remove separators from an ID
escape_unicode()Replace extended Latin characters with escaped Unicode
extract_parts()Extract ID parts
file_sans_ext()Extract filename without extension
gather_subjects()Gather ESAJ subjects automatically
lsos()List objects in an R session
pattern_cnj()Regex pattern to find IDs
precision()Apply precision scale
reais()Convert BRL strings into numbers
rm_accent()Remove diacritics from a string
sample_cnj()Create a random sample of IDs
separate_cnj()Separate a column of IDs into 6 columns with its components
tabela()Create a contingency table of a vector
test_fun()Check if all arguments from a function are set
verify_cnj()Check if ID conforms with CNJ’s standard
write_data()Write file to data/

Usage

Example 1:

# Remove separators from ID
abjutils::clean_id(c("1025736-09.2014.8.26.0100","0043877-64.2012.8.26.0100","1013689-61.2018.8.26.0100"))
#> [1] "10257360920148260100" "00438776420128260100" "10136896120188260100"

Example 2:

# Extract components from ID
abjutils::extract_parts(c("1025736-09.2014.8.26.0100","0043877-64.2012.8.26.0100","1013689-61.2018.8.26.0100"))
#> [[1]]
#>         N         D         A         J         T         O 
#> "1025736"      "09"    "2014"       "8"      "26"    "0100" 
#> 
#> [[2]]
#>         N         D         A         J         T         O 
#> "0043877"      "64"    "2012"       "8"      "26"    "0100" 
#> 
#> [[3]]
#>         N         D         A         J         T         O 
#> "1013689"      "61"    "2018"       "8"      "26"    "0100"

Example 3:

# Remove diacritics from string
abjutils::rm_accent("acórdão")
#> [1] "acordao"

Dependencies

{abjutils} requires R >= 3.6.

License

{abjutils} is licensed under MIT + file LICENSE

Copy Link

Version

Install

install.packages('abjutils')

Monthly Downloads

615

Version

0.3.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

ABJ

Last Published

February 1st, 2022

Functions in abjutils (0.3.2)

clean_id

Remove separators from lawsuit IDs
sample_cnj

Generate sample Brazilian lawsuit identification numbers
separate_cnj

Separate a lawsuit ID column into its parts
lsos

Improved list of objects
tabela

Produce frequency and relative frequency tables
pattern_cnj

Regex pattern for finding lawsuit numbers
test_fun

Tests a function by checking if its arguments are declared
rm_accent

Remove accentuation
reais

Convert Brazilian currency values (text) to numeric
verify_cnj

Validate Brazilian lawsuits identification number on vectors.
escape_unicode

Escape accented characters in a document
gather_subjects

Gather subjects from esaj::cjsg_table("subjects")
file_sans_ext

Extract file name without extension
%>%

Pipe operator
precision

Mirror of scales:::precision()
extract_parts

Extract different parts from lawsuit ID
chrome_to_body

Convert Chrome's Query String Parameters to a list
check_dig

Validate check digits for Brazilian lawsuits identification number
check_dig_vet

Validate check digits for Brazilian lawsuits identification number on vectors.
carf_check_dig

Validate check digits for Brazilian lawsuits identification number
carf_build_id

Add separators to CARF lawsuits
carf_calc_dig

Calculate check digit for CARF
calc_dig

Calculate digits for Brazilian lawsuit identification numbers
build_id

Add separators to lawsuit IDs
write_data

Shortcut to write file to "data/" directory from a pipe
clean_cnj

Clean a cnj number.