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

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

## get_unemployment()

Retrieves Brazil's quarterly unemployment rate from IBGE's Continuous PNAD.

### Parameters

- `start_year`: Starting year (e.g., 2015)
- `end_year`: Ending year (e.g., 2024)
- `language`: Labels language - `"eng"` (default) or `"pt"`

### Usage

```{r unemployment-usage, eval=FALSE}
library(brfinance)

# English version
unemp_eng <- get_unemployment(2018, 2024, language = "eng")
head(unemp_eng)

# Portuguese version
unemp_pt <- get_unemployment(2018, 2024, language = "pt") 
head(unemp_pt)
```

### Output Structure
**English:**
```
# A tibble: 28 × 2
   date        rate
   <date>     <dbl>
 1 2018-01-01  12.2
 2 2018-04-01  12.9
```

**Portuguese:**
```
# A tibble: 28 × 2
   data        taxa
   <date>     <dbl>
 1 2018-01-01  12.2
```
## plot_unemployment()

Generates a line chart of unemployment rate.

### Parameters

- `data`: Data from `get_unemployment()`
- `language`: Plot labels - `"eng"` (default) or `"pt"`

### Usage

```{r unemployment-plot, message=FALSE, warning=FALSE, fig.height=5, fig.width=10, fig.align='center', out.width='90%'}
library(brfinance)

# Get data
unemp_data <- get_unemployment(2020, 2024)

# Create plot
unemp_plot <- plot_unemployment(unemp_data, language = "eng")
print(unemp_plot)

# Portuguese version
unemp_data2 <- get_unemployment(2020, 2024, language = "pt")
unemp_plot_pt <- plot_unemployment(unemp_data2, language = "pt")
print(unemp_plot_pt)
```
