---
title: "Scenario"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Scenario}
  %\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 <- dplyr::arrange(table, match(column, names(get(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)
}
```

## Climate transition scenario dataset (technology pathways for target market share calculation)

Climate transition scenario dataset, prepared for the PACTA for Banks software, e.g. based on scenarios from the International Energy Agency (IEA). Includes the relative change through time in production across industrial sectors and technologies.

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

The `{pacta.loanbook}` package provides an example climate transition scenario dataset `scenario_demo_2020`.

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

## Climate transition scenario dataset (CO^2^ intensity pathways for sectoral decarbonization approach)

CO^2^ intensity climate transition scenario dataset, prepared for the PACTA for Banks software, e.g. based on scenarios from the International Energy Agency (IEA). Includes the change through time in production-based emission intensity across industrial sectors.

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

The `{pacta.loanbook}` package provides an example CO^2^ intensity climate transition scenario dataset `co2_intensity_scenario_demo`.

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