---
title: "ANEEL"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{ANEEL}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

Loads data from the National Electrical Energy Agency (ANEEL), a Brazilian independent federal agency linked to the Ministry of Mines and Energy (MME). ANEEL works to provide favorable conditions for the Electrical Energy Market to develop with balance and for the benefit of society.

As for now, there are three different datasets available for download: the Energy Development Budget and the Energy Generation.

#### Energy Development Budget

The Energy Development Budget dataset showcases the Energy Development Account's (CDE) anual budget expenses. The CDE is designed to promote the Brazilian energy development and is managed by the Electrical Energy Commercialization Chamber (CCEE).

The dataset makes available the year of the observation -- from 2013 to 2022 --, the type of expense, its value in R$ (Reais) and its share over the total amount of CDE budget expenses on the year\*.

\*Note that 'share_of_total' values sum to 1 for each year available.

#### Energy Generation
The Energy Generation dataset showcases information about ANEEL's Generation Informations System (SIGA). SIGA provides information about the Brazilian electrical energy generation installed capacity.

The dataset provides information at the individual venture/entity level. It contains information about the power, source, stage, type of permission, origin and final fuel with which each venture/entity operates, as well as other legal, technical and geographical information.* Operation start dates contained in the dataset go as far back as 1924 up to 2022.

\* For more details on each variable, access [This link](https://app.powerbi.com/view?r=eyJrIjoiNjc4OGYyYjQtYWM2ZC00YjllLWJlYmEtYzdkNTQ1MTc1NjM2IiwidCI6IjQwZDZmOWI4LWVjYTctNDZhMi05MmQ0LWVhNGU5YzAxNzBlMSIsImMiOjR9) and select "Manual do Usuario".


#### Energy Enterprises
The Energy Enterprises dataset showcases information about distributed micro and mini generators, covered by the Regulatory Resolution nº 482/2012. The list of projects is classified by variables that make up their identification, namely: connected distributor, project code, numerical nucleus of the project code, owner name, production class, subgroup, name of the owner, number of consumer units that receive credits, connection date, type of generating unit, source, installed power, municipality, and federative unit where it is located.

The data is expressed in quantities and installed power in kW (kilowatt). The quantity corresponds to the number of distributed micro or mini generators installed in the specified period. The installed power is defined by the sum of the nominal active electric power of the generating units. 

\* For more details on each variable, access [This link](https://dadosabertos.aneel.gov.br/dataset/relacao-de-empreendimentos-de-geracao-distribuida) and select "Dicionário de dados".


***
**Options:**

  1. **dataset**: there are three choices:
      * `"energy_development_budget"`: government spending towards energy sources
      * `"energy_generation"`: energy generation by entity/corporation
      * `"energy_enterprises_distributed"`: distributed micro and mini generators

  2. **raw_data**: there are two options:
      * `TRUE`: if you want the data as it is originally.
      * `FALSE`: if you want the treated version of the data. 

  3. **language**: you can choose between Portuguese `("pt")` and English `("eng")`
  
***

**Examples:**  
  
```{r eval=FALSE}
# download treated data about energy generation
clean_aneel <- load_aneel(
  dataset = "energy generation",
  raw_data = FALSE
)
```
