-
Notifications
You must be signed in to change notification settings - Fork 7
/
README.Rmd
143 lines (111 loc) · 4.45 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# r2dii.analysis <img src="man/figures/logo.png" align="right" width="120" />
<!-- badges: start -->
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN status](https://www.r-pkg.org/badges/version/r2dii.analysis)](https://CRAN.R-project.org/package=r2dii.analysis)
[![Codecov test coverage](https://codecov.io/gh/RMI-PACTA/r2dii.analysis/branch/main/graph/badge.svg)](https://app.codecov.io/gh/RMI-PACTA/r2dii.analysis?branch=main)
[![R-CMD-check](https://github.com/RMI-PACTA/r2dii.analysis/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RMI-PACTA/r2dii.analysis/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
These tools help you to assess if a financial portfolio aligns with climate
goals. They summarize key metrics attributed to the portfolio (e.g.
production, emission factors), and calculate targets based on climate
scenarios. They implement in R the last step of the free software 'PACTA'
(Paris Agreement Capital Transition Assessment;
<https://www.transitionmonitor.com/>). Financial institutions use 'PACTA' to
study how their capital allocation impacts the climate.
## Installation
Install the released version of r2dii.analysis from CRAN with:
```r
install.packages("r2dii.analysis")
```
Or install the development version of r2dii.analysis from GitHub with:
```r
# install.packages("pak")
pak::pak("RMI-PACTA/r2dii.analysis")
```
## Example
* Use `library()` to attach the packages you need. r2dii.analysis does not depend on the packages r2dii.data and r2dii.match; but we suggest you install them -- with `install.packages(c("r2dii.data", "r2dii.match"))` -- so you can reproduce our examples.
```{r}
library(r2dii.data)
library(r2dii.match)
library(r2dii.analysis)
```
* Use `r2dii.match::match_name()` to identify matches between your loanbook and the asset level data.
```{r}
matched <- match_name(loanbook_demo, abcd_demo) %>%
prioritize()
```
### Add Scenario Targets
* Use `target_sda()` to calculate SDA targets of CO2 emissions.
```{r}
matched %>%
target_sda(
abcd = abcd_demo,
co2_intensity_scenario = co2_intensity_scenario_demo,
region_isos = region_isos_demo
)
```
* Use `target_market_share` to calculate market-share scenario targets at the portfolio level:
```{r}
matched %>%
target_market_share(
abcd = abcd_demo,
scenario = scenario_demo_2020,
region_isos = region_isos_demo
)
```
* Or at the company level:
```{r}
matched %>%
target_market_share(
abcd = abcd_demo,
scenario = scenario_demo_2020,
region_isos = region_isos_demo,
by_company = TRUE
)
```
### Utility Functions
The `target_*()` functions provide shortcuts for common operations. They wrap some utility functions that you may also use directly:
* Use `join_abcd_scenario()` to join a matched dataset to the relevant
scenario data, and to pick assets in the relevant regions.
```{r}
loanbook_joined_to_abcd_scenario <- matched %>%
join_abcd_scenario(
abcd = abcd_demo,
scenario = scenario_demo_2020,
region_isos = region_isos_demo
)
```
* Use `summarize_weighted_production()` with different grouping arguments to
calculate scenario-targets:
```{r}
# portfolio level
loanbook_joined_to_abcd_scenario %>%
summarize_weighted_production(scenario, tmsr, smsp, region)
# company level
loanbook_joined_to_abcd_scenario %>%
summarize_weighted_production(scenario, tmsr, smsp, region, name_abcd)
```
[Get started](https://rmi-pacta.github.io/r2dii.analysis/articles/r2dii-analysis.html).
```{r echo=FALSE}
download.file("http://bit.ly/banks-thanks", thanks <- tempfile())
```
## Funding
This project has received funding from the [European Union LIFE
program](https://wayback.archive-it.org/12090/20210412123959/https://ec.europa.eu/easme/en/) and the International Climate Initiative (IKI).
The Federal Ministry for the Environment, Nature Conservation and Nuclear Safety
(BMU) supports this initiative on the basis of a decision adopted by the German
Bundestag. The views expressed are the sole responsibility of the authors and do
not necessarily reflect the views of the funders. The funders are not
responsible for any use that may be made of the information it contains.