cccneto / Ibamam

Base de dados sobre multas e autuações ambientais do Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renováveis - IBAMA.
https://cccneto.github.io/Ibamam/
Other
12 stars 6 forks source link

Ibamam

DOI R-ubuntu

This package aims to provide the dataset for environmental fines and notices from the Brazilian Institute for the Environment and Renewable Natural Resources (IBAMA).

You can visit the IBAMA repository in the Brazilian Open Data Portal.

How to install?

This package can be installed via GitHub using the following code in R:

# install.packages("remotes")
remotes::install_github("cccneto/Ibamam")

How to use Ibamam?

The {Ibamam} package has one function available: get_dataset_ibamam(). This function returns a tibble, containing several columns described in the documentation of the function. This function has three arguments: dataset , uf and clean.

Examples on how to use this function:

library(Ibamam)

# get fines applied by IBAMA in Pará
fines_applied_Para <- get_dataset_ibamam(dataset = "distribuidas", uf = "PA")

dplyr::glimpse(fines_applied_Para)
#> Rows: 59,703
#> Columns: 16
#> $ dataAuto                   <date> 2021-04-23, 2020-09-28, 2021-02-10, 2020-0…
#> $ nomeMunicipio              <chr> "PLACAS", "RUROPOLIS", "MARAPANIM", "PRAINH…
#> $ nomeMunicipio_geobr        <chr> "Placas", "Rurópolis", "Marapanim", "Prainh…
#> $ codigoMunicipio            <chr> "1505650", "1506195", "1504406", "1506005",…
#> $ numAI                      <chr> "ABYX5X27 - ", "AB1FQ5MJ - ", "AD6DF079 - "…
#> $ tipoInfracao               <fct> Outras, Flora, Unidades de conservação, Flo…
#> $ ultimaAtualizacaoRelatorio <dttm> 2021-05-29 19:15:00, 2021-05-29 19:15:00, …
#> $ uf                         <chr> "PA", "PA", "PA", "PA", "PA", "PA", "PA", "…
#> $ situacaoDebito             <chr> "Para homologação/prazo de defesa", "Para h…
#> $ tipoAuto                   <fct> Multa, Multa, Multa, Multa, Multa, Multa, M…
#> $ moeda                      <fct> Real, Real, Real, Real, Real, Real, Real, R…
#> $ enquadramentoLegal         <fct> "Decreto 6514/2008 - Artigo 79", "Decreto 6…
#> $ nomeRazaoSocial            <chr> "ILSON ALVES DE FARIA", "ABIDIEL CELESTINO …
#> $ cpfCnpj                    <chr> "651.179.132-72", "516.819.352-87", "667.55…
#> $ valorAuto                  <dbl> 10000.0, 8000.0, 2000.0, 180729.9, 2015000.…
#> $ enquadramentoJuridico      <fct> CPF, CPF, CPF, CNPJ, CPF, CPF, CPF, CNPJ, C…

# get fines collected by IBAMA in Pará
fines_collected_Para <- get_dataset_ibamam(dataset = "arrecadadas", uf = "PA")

dplyr::glimpse(fines_collected_Para)
#> Rows: 73,686
#> Columns: 21
#> $ dataAuto                   <date> 2019-12-01, 2020-03-20, 2020-03-10, 2020-0…
#> $ nomeMunicipio              <chr> "PACAJA", "ANANINDEUA", "ANANINDEUA", "ANAN…
#> $ nomeMunicipio_geobr        <chr> "Pacajá", "Ananindeua", "Ananindeua", "Anan…
#> $ codigoMunicipio            <chr> "1505486", "1500800", "1500800", "1500800",…
#> $ dataPagamento              <date> 2020-12-16, 2021-02-17, 2021-02-22, 2021-0…
#> $ valorPago                  <dbl> 8400.32, 863.86, 866.96, 863.86, 863.86, 10…
#> $ numAI                      <chr> "C7AZB2I8 - ", "DB3W3QKR - ", "GUN4XIPO - "…
#> $ tipoInfracao               <fct> Flora, Outras, Outras, Outras, Outras, Flor…
#> $ ultimaAtualizacaoRelatorio <dttm> 2021-05-29 19:26:00, 2021-05-29 19:26:00, …
#> $ parcela                    <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3…
#> $ quantidadeParcela          <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 30, 30,…
#> $ uf                         <chr> "PA", "PA", "PA", "PA", "PA", "PA", "PA", "…
#> $ tipoAuto                   <fct> Multa, Multa, Multa, Multa, Multa, Multa, M…
#> $ moeda                      <fct> Real, Real, Real, Real, Real, Real, Real, R…
#> $ statusDebito               <chr> "Quitado. Baixa automática", "Quitado. Baix…
#> $ enquadramentoLegal         <fct> "Decreto 6514/2008 - Artigo 47", "Decreto 6…
#> $ nomeRazaoSocial            <chr> "SIMONE SOUZA MORAES", "JATEX TRANSPORTES L…
#> $ cpfCnpj                    <chr> "019.077.525-44", "39.124.797/0004-17", "43…
#> $ valorbaseParcela           <dbl> 11524.50, 1200.00, 1200.00, 1200.00, 1200.0…
#> $ valorAuto                  <dbl> 11524.5, 1200.0, 1200.0, 1200.0, 1200.0, 15…
#> $ enquadramentoJuridico      <fct> CPF, CNPJ, CNPJ, CNPJ, CNPJ, CPF, CNPJ, CNP…

If you want to get the data for the whole country (Brazil), do not write anything in the argument uf.

# get fines applied by IBAMA in Brazil
fines_applied_Brasil <- get_dataset_ibamam(dataset = "distribuidas")

# get fines collected by IBAMA in Brazil
fines_collected_Brasil <- get_dataset_ibamam(dataset = "arrecadadas")

If you want to get the data for more than one state, but not for the whole country, use a vector in the argument uf with the abbreviations of the name of the states.

# get fines applied by IBAMA in Southeast of Brazil
fines_applied_southeast <- get_dataset_ibamam(dataset = "distribuidas", uf = c("SP", "RJ", "ES", "MG"))

# get fines collected by IBAMA in Southeast of Brazil
fines_collected_southeast <- get_dataset_ibamam(dataset = "arrecadadas", uf = c("SP", "RJ", "ES", "MG"))

If you want to access the original data, without the cleaning steps, use the argument clean = FALSE. Example:

# get fines applied by IBAMA in São Paulo, without cleaning the dataset
untidy_fines_applied_SP <- get_dataset_ibamam(dataset = "distribuidas", uf = "SP", clean = FALSE)

dplyr::glimpse(untidy_fines_applied_SP)
#> Rows: 34,598
#> Columns: 13
#> $ dataAuto                   <chr> "22/04/2020", "17/10/2019", "27/01/2020", "…
#> $ municipio                  <chr> "SAO JOSE DO RIO PRETO", "MARILIA", "SAO JO…
#> $ numAI                      <chr> "AC6FODNB - ", "ADX7F7IM - ", "AEGEYX7V - "…
#> $ tipoInfracao               <chr> "Fauna", "Fauna", "Fauna", "Controle ambien…
#> $ ultimaAtualizacaoRelatorio <chr> "29/05/2021 19:23", "29/05/2021 19:23", "29…
#> $ uf                         <chr> "SP", "SP", "SP", "SP", "SP", "SP", "SP", "…
#> $ situacaoDebito             <chr> "Quitado. Baixa automática", "Cancelado", "…
#> $ tipoAuto                   <chr> "Multa", "Multa", "Multa", "Multa", "Multa"…
#> $ moeda                      <chr> "Real", "Real", "Real", "Real", "Real", "Re…
#> $ enquadramentoLegal         <chr> "Decreto 6514/2008 - Artigo 3º, Instrução N…
#> $ nomeRazaoSocial            <chr> "JOSE ELIEZER DO PRADO DOS SANTOS", "VALTER…
#> $ cpfCnpj                    <chr> "368.573.748-13", "063.360.978-11", "102.74…
#> $ valorAuto                  <dbl> 500, 500, 500, 45000, 1300, 1300, 400500, 5…

Data cleaning

By default, the function get_dataset_ibamam() will use clean = TRUE and perform the following cleaning steps:

If you want to access the original data (without the cleaning steps), use the argument clean = FALSE.

How to cite Ibamam Package

DOICRUZ NETO, Claudiano C., MILZ, Beatriz, MACEDO, Samuel (2021). Ibamam: Pacote para tratamento da Base de dados para multas e autuações ambientais aplicadas pelo Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renováveis - Brasil. https://doi.org/10.5281/zenodo.4509344”.