-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
294 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,62 @@ | ||
Package: abjutils | ||
Type: Package | ||
Date: 2018-01-18 | ||
Title: Useful Tools for Jurimetrical Analysis Used by the Brazilian Jurimetrics Association | ||
Description: The Brazilian Jurimetrics Association (ABJ in Portuguese, | ||
see <http://www.abjur.org.br/en/> for more information) is a non-profit | ||
organization which aims to investigate and promote the use of | ||
statistics and probability in the study of Law and its institutions. | ||
This package implements general purpose tools used by ABJ, such as functions | ||
for sampling and basic manipulation of Brazilian lawsuits identification | ||
number. It also implements functions for text cleaning, such as accentuation removal. | ||
Package: abjutils | ||
Title: Useful Tools for Jurimetrical Analysis Used by the | ||
Brazilian Jurimetrics Association | ||
Version: 0.2.3 | ||
Authors@R: c( | ||
person("Julio", "Trecenti", role = "aut", email = "[email protected]"), | ||
person("Athos", "Damiani", role = "ctb", email = "[email protected]"), | ||
person("Fernando", "Correa", role = "aut", email = "[email protected]"), | ||
person("Caio", "Lente", role = c("aut","cre"), email = "[email protected]"), | ||
person(family = "Brazilian Jurimetrics Association", role = "cph")) | ||
Date: 2018-01-18 | ||
Authors@R: | ||
c(person(given = "Julio", | ||
family = "Trecenti", | ||
role = "aut", | ||
email = "[email protected]"), | ||
person(given = "Athos", | ||
family = "Damiani", | ||
role = "ctb", | ||
email = "[email protected]"), | ||
person(given = "Fernando", | ||
family = "Correa", | ||
role = "aut", | ||
email = "[email protected]"), | ||
person(given = "Caio", | ||
family = "Lente", | ||
role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
person(family = "Brazilian Jurimetrics Association", | ||
role = "cph")) | ||
Maintainer: Caio Lente <[email protected]> | ||
URL: https://github.com/abjur/abjutils | ||
LazyData: TRUE | ||
Depends: R (>= 3.4) | ||
Description: The Brazilian Jurimetrics Association (ABJ in | ||
Portuguese, see <http://www.abjur.org.br/en/> for more information) is | ||
a non-profit organization which aims to investigate and promote the | ||
use of statistics and probability in the study of Law and its | ||
institutions. This package implements general purpose tools used by | ||
ABJ, such as functions for sampling and basic manipulation of | ||
Brazilian lawsuits identification number. It also implements functions | ||
for text cleaning, such as accentuation removal. | ||
License: MIT + file LICENSE | ||
URL: https://github.com/abjur/abjutils | ||
Depends: | ||
R (>= 3.4) | ||
Imports: | ||
stringr, | ||
dplyr, | ||
httr, | ||
tibble, | ||
devtools, | ||
magrittr, | ||
purrr, | ||
rstudioapi, | ||
scales, | ||
stringi, | ||
glue, | ||
tidyr, | ||
progress, | ||
furrr, | ||
future, | ||
readr, | ||
rlang | ||
Suggests: testthat | ||
devtools, | ||
dplyr, | ||
furrr, | ||
future, | ||
glue, | ||
httr, | ||
magrittr, | ||
progress, | ||
purrr, | ||
readr, | ||
rlang, | ||
rstudioapi, | ||
scales, | ||
stringi, | ||
stringr, | ||
tibble, | ||
tidyr | ||
Suggests: | ||
testthat | ||
LazyData: TRUE | ||
Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", | ||
"collate")) | ||
RoxygenNote: 6.1.1 | ||
Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
|
||
#' @title Gather subjects from esaj::cjsg_table("subjects") | ||
#' | ||
#' | ||
#' @description Once you run `esaj::cjsg_table("subjects")`, you can | ||
#' use this function to gather the subjects automatically. Download | ||
#' `esaj` by running `devtools::install_github("courtsbr/esaj")`. | ||
#' | ||
#' | ||
#' @param subjects Table returned by `esaj::cjsg_table("subjects")` | ||
#' | ||
#' | ||
#' @export | ||
gather_subjects <- function(subjects) { | ||
unite_index <- function(d, i) { | ||
tidyr::unite_(d, paste0("level", i), paste0(c("id", "name"), i)) | ||
} | ||
col <- readr::cols(.default = readr::col_character()) | ||
purrr::reduce(0:5, unite_index, .init = subjects) %>% | ||
tidyr::gather() %>% | ||
tidyr::separate(value, c("id", "nm"), sep = "_") %>% | ||
dplyr::distinct(id, .keep_all = TRUE) %>% | ||
readr::type_convert(col_types = col) %>% | ||
purrr::reduce(0:5, unite_index, .init = subjects) %>% | ||
tidyr::gather() %>% | ||
tidyr::separate(value, c("id", "nm"), sep = "_") %>% | ||
dplyr::distinct(id, .keep_all = TRUE) %>% | ||
readr::type_convert(col_types = col) %>% | ||
dplyr::filter(!is.na(id)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.