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

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

```{r setup, echo = FALSE, message = FALSE}
library(pacta.loanbook)

plot_table <- function(dataset_name) {
  table <- data_dictionary
  table <- dplyr::filter(table, .data[["dataset"]] == dataset_name)
  table_plot <- gt::gt(dplyr::select(table, -"dataset"))
  
  table_plot <- 
    gt::cols_width(
      .data = table_plot,
      column ~ gt::px(150),
      typeof ~ gt::px(90)
    )
  
  table_plot <-
    gt::tab_style(
      data = table_plot,
      style = gt::cell_text(size = "smaller"),
      locations = gt::cells_body(columns = 1:2)
    )
  
  table_plot <-
    gt::tab_options(
      data = table_plot,
      ihtml.active = TRUE,
      ihtml.use_pagination = FALSE,
      ihtml.use_sorting = TRUE,
      ihtml.use_highlight = TRUE
    )
  
  gt::fmt_passthrough(table_plot)
}
```

## match_name() output

The output of `match_name()` has the following columns:

```{r, echo = FALSE}
plot_table("match_name_output")
```

## prioritize() output

The output of `prioritize()` has the following columns:

```{r, echo = FALSE}
plot_table("prioritize_output")
```

## target_market_share() output

The output of `target_market_share()` has the following columns:

```{r, echo = FALSE}
plot_table("target_market_share_output")
```

The `{pacta.loanbook}` package provides a demo `target_market_share()` output dataset `market_share`.

```{r, R.options = list(width = 400)}
market_share
```

## target_sda() output

The output of `target_sda()` has the following columns:

```{r, echo = FALSE}
plot_table("target_sda_output")
```

The `{pacta.loanbook}` package provides a demo `target_sda()` output dataset `sda`.

```{r, R.options = list(width = 400)}
sda
```

## prep_techmix() output

The output of `prep_techmix()` has the following columns:

```{r, echo = FALSE}
plot_table("prep_techmix_output")
```

## prep_emission_intensity() output

The output of `prep_emission_intensity()` has the following columns:

```{r, echo = FALSE}
plot_table("prep_emission_intensity_output")
```

## prep_trajectory() output

The output of `prep_trajectory()` has the following columns:

```{r, echo = FALSE}
plot_table("prep_trajectory_output")
```