Returns a data frame containing a random sample of lawsuit numbers distributed according to some regional and jurisdictional parameters. The implementation supports both vector and scalar parameters, depending whether or not the function should uniformly sample from a scope of lawsuit numbers or one should define the parameters for each sample unit.

sample_cnj(
  n,
  foros,
  anos,
  orgao,
  tr,
  first_dig = "0",
  sample_pars = TRUE,
  return_df = TRUE
)

Arguments

n

A non negative integer giving the number of codes to generate

foros

One or more strings with 4 characters indicating the juridical forum for the sampled codes

anos

One or more strings with 4 characters indicating the distribution years of the generated codes

orgao

One or more strings with 1 character indicating the jurisdiction of the sampled codes.

tr

One or more strings with 1 character indicating the court of the generated codes

first_dig

The first digit of the lawsuit code ("0" by default and sampled if "")

sample_pars

Whether or not the parameters define the characteristics of the codes

return_df

Whether or not the function should return a data frame

Value

A data frame or a vector containing a random sample of lawsuits IDs

Examples

{
  # sampling the parameters
  sample_cnj(3,
    foros = "0000",
    anos = "2015", orgao = 8, tr = 26,
    first_dig = "0", sample_pars = TRUE, return_df = FALSE
  )

  sample_cnj(10,
    foros = c("0000", "0001"),
    anos = c("2014", "2015"), orgao = 8, tr = 26,
    first_dig = "0", sample_pars = TRUE, return_df = FALSE
  )

  # not sampling the parameters

  sample_cnj(3,
    foros = c("0000", "0001", "0002"),
    anos = c("2014", "2015", "2016"), orgao = rep(8, 3), tr = rep(26, 3),
    first_dig = "0", sample_pars = FALSE, return_df = FALSE
  )
}
#> Warning: `data_frame()` was deprecated in tibble 1.1.0.
#> Please use `tibble()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> [1] "05221035620148260000" "08082636320158260001" "08022467120168260002"