Skip to content

Commit a068675

Browse files
authored
Merge pull request #447 from RMI-PACTA/release/0.3.0
Release/0.3.0
2 parents 66f02b7 + a41dfe5 commit a068675

File tree

9 files changed

+93
-103
lines changed

9 files changed

+93
-103
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.RData
44
.Ruserdata
55
docs
6+
revdep/

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: r2dii.analysis
22
Title: Measure Climate Scenario Alignment of Corporate Loans
3-
Version: 0.2.1.9000
3+
Version: 0.3.0
44
Authors@R:
55
c(person(given = "Alex",
66
family = "Axthelm",
@@ -48,7 +48,7 @@ Imports:
4848
glue,
4949
lifecycle,
5050
magrittr,
51-
r2dii.data,
51+
r2dii.data (>= 0.4.0),
5252
rlang (>= 0.1.2),
5353
tidyr,
5454
tidyselect,

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# r2dii.analysis (development version)
1+
# r2dii.analysis 0.3.0
22

33
# `target_sda` now uses final year of scenario as convergence target when `by_company = TRUE` (#445).
44
# `target_market_share` gains argument `increasing_or_decreasing` (#426).

R/summarize_weighted_production.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
#' abcd = abcd,
4545
#' scenario = scenario_demo_2020,
4646
#' region_isos = region_isos_demo
47-
#' )
47+
#' ) %>%
48+
#' dplyr::filter(production != 0)
4849
#'
4950
#' summarize_weighted_production(master)
5051
#'

R/target_sda.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ compute_loanbook_targets <- function(data,
382382
data <- data %>%
383383
group_by(!!!rlang::syms(...)) %>%
384384
arrange(.data$year) %>%
385-
tidyr::complete(.data$name_abcd, year) %>%
385+
tidyr::complete(.data$name_abcd, .data$year) %>%
386386
ungroup() %>%
387387
select(-all_of(c("emission_factor_adjusted_scenario", "p"))) %>%
388388
right_join(

README.md

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ climate goals. They summarize key metrics attributed to the portfolio
2121
(e.g. production, emission factors), and calculate targets based on
2222
climate scenarios. They implement in R the last step of the free
2323
software ‘PACTA’ (Paris Agreement Capital Transition Assessment;
24-
<https://www.transitionmonitor.com/>). Financial institutions use ‘PACTA’ to
25-
study how their capital allocation impacts the climate.
24+
<https://www.transitionmonitor.com/>). Financial institutions use
25+
‘PACTA’ to study how their capital allocation impacts the climate.
2626

2727
## Installation
2828

@@ -73,21 +73,21 @@ matched %>%
7373
region_isos = region_isos_demo
7474
)
7575
#> Warning: Removing rows in abcd where `emission_factor` is NA
76-
#> # A tibble: 166 × 6
77-
#> sector year region scenario_source emission_factor_met…¹ emiss…²
78-
#> <chr> <dbl> <chr> <chr> <chr> <dbl>
79-
#> 1 cement 2013 advanced economies demo_2020 projected 0.0217
80-
#> 2 cement 2013 developing asia demo_2020 projected 0.0606
81-
#> 3 cement 2013 global demo_2020 projected 0.658
82-
#> 4 cement 2014 advanced economies demo_2020 projected 0.0219
83-
#> 5 cement 2014 developing asia demo_2020 projected 0.0604
84-
#> 6 cement 2014 global demo_2020 projected 0.659
85-
#> 7 cement 2015 advanced economies demo_2020 projected 0.0221
86-
#> 8 cement 2015 developing asia demo_2020 projected 0.0603
87-
#> 9 cement 2015 global demo_2020 projected 0.660
88-
#> 10 cement 2016 advanced economies demo_2020 projected 0.0223
89-
#> # … with 156 more rows, and abbreviated variable names ¹​emission_factor_metric,
90-
#> # ²​emission_factor_value
76+
#> # A tibble: 96 × 6
77+
#> sector year region scenario_source emission_factor_metric
78+
#> <chr> <dbl> <chr> <chr> <chr>
79+
#> 1 steel 2021 advanced economies demo_2020 projected
80+
#> 2 steel 2021 global demo_2020 projected
81+
#> 3 steel 2022 advanced economies demo_2020 projected
82+
#> 4 steel 2022 global demo_2020 projected
83+
#> 5 steel 2024 advanced economies demo_2020 projected
84+
#> 6 steel 2024 global demo_2020 projected
85+
#> 7 steel 2025 advanced economies demo_2020 projected
86+
#> 8 steel 2025 global demo_2020 projected
87+
#> 9 steel 2027 advanced economies demo_2020 projected
88+
#> 10 steel 2027 global demo_2020 projected
89+
#> # ℹ 86 more rows
90+
#> # ℹ 1 more variable: emission_factor_value <dbl>
9191
```
9292

9393
- Use `target_market_share` to calculate market-share scenario targets
@@ -100,22 +100,22 @@ matched %>%
100100
scenario = scenario_demo_2020,
101101
region_isos = region_isos_demo
102102
)
103-
#> # A tibble: 1,790 × 10
104-
#> sector techno…¹ year region scena…² metric produ…³ techn…⁴ scope perce…⁵
105-
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl> <dbl> <chr> <dbl>
106-
#> 1 automotive electric 2020 global demo_2… proje… 324592. 0.0759 sect… 0
107-
#> 2 automotive electric 2020 global demo_2… targe… 324592. 0.0759 sect… 0
108-
#> 3 automotive electric 2020 global demo_2… targe… 324592. 0.0759 sect… 0
109-
#> 4 automotive electric 2020 global demo_2… targe… 324592. 0.0759 sect… 0
110-
#> 5 automotive electric 2021 global demo_2… proje… 339656. 0.0786 sect… 0.00352
111-
#> 6 automotive electric 2021 global demo_2… targe… 329191. 0.0744 sect… 0.00108
112-
#> 7 automotive electric 2021 global demo_2… targe… 352505. 0.0809 sect… 0.00653
113-
#> 8 automotive electric 2021 global demo_2… targe… 330435. 0.0747 sect… 0.00137
114-
#> 9 automotive electric 2022 global demo_2… proje… 354720. 0.0813 sect… 0.00705
115-
#> 10 automotive electric 2022 global demo_2… targe… 333693. 0.0730 sect… 0.00213
116-
#> # … with 1,780 more rows, and abbreviated variable names ¹​technology,
117-
#> # ²​scenario_source, ³​production, ⁴​technology_share,
118-
#> # ⁵​percentage_of_initial_production_by_scope
103+
#> # A tibble: 1,232 × 10
104+
#> sector technology year region scenario_source metric production
105+
#> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl>
106+
#> 1 automotive electric 2020 global demo_2020 projected 3664.
107+
#> 2 automotive electric 2020 global demo_2020 target_cps 3664.
108+
#> 3 automotive electric 2020 global demo_2020 target_sds 3664.
109+
#> 4 automotive electric 2020 global demo_2020 target_sps 3664.
110+
#> 5 automotive electric 2021 global demo_2020 projected 8472.
111+
#> 6 automotive electric 2021 global demo_2020 target_cps 3845.
112+
#> 7 automotive electric 2021 global demo_2020 target_sds 4766.
113+
#> 8 automotive electric 2021 global demo_2020 target_sps 3894.
114+
#> 9 automotive electric 2022 global demo_2020 projected 8436.
115+
#> 10 automotive electric 2022 global demo_2020 target_cps 4023.
116+
#> # ℹ 1,222 more rows
117+
#> # ℹ 3 more variables: technology_share <dbl>, scope <chr>,
118+
#> # percentage_of_initial_production_by_scope <dbl>
119119
```
120120

121121
- Or at the company level:
@@ -132,23 +132,22 @@ matched %>%
132132
#> This will result in company-level results, weighted by the portfolio
133133
#> loan size, which is rarely useful. Did you mean to set one of these
134134
#> arguments to `FALSE`?
135-
#> # A tibble: 32,402 × 11
136-
#> sector techno…¹ year region scena…² name_…³ metric produ…⁴ techn…⁵ scope
137-
#> <chr> <chr> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <chr>
138-
#> 1 automotive electric 2020 global demo_2… toyota… proje… 324592. 0.0759 sect…
139-
#> 2 automotive electric 2020 global demo_2… toyota… targe… 324592. 0.0759 sect…
140-
#> 3 automotive electric 2020 global demo_2… toyota… targe… 324592. 0.0759 sect…
141-
#> 4 automotive electric 2020 global demo_2… toyota… targe… 324592. 0.0759 sect…
142-
#> 5 automotive electric 2021 global demo_2… toyota… proje… 339656. 0.0786 sect…
143-
#> 6 automotive electric 2021 global demo_2… toyota… targe… 329191. 0.0744 sect…
144-
#> 7 automotive electric 2021 global demo_2… toyota… targe… 352505. 0.0809 sect…
145-
#> 8 automotive electric 2021 global demo_2… toyota… targe… 330435. 0.0747 sect…
146-
#> 9 automotive electric 2022 global demo_2… toyota… proje… 354720. 0.0813 sect…
147-
#> 10 automotive electric 2022 global demo_2… toyota… targe… 333693. 0.0730 sect…
148-
#> # … with 32,392 more rows, 1 more variable:
149-
#> # percentage_of_initial_production_by_scope <dbl>, and abbreviated variable
150-
#> # names ¹​technology, ²​scenario_source, ³​name_abcd, ⁴​production,
151-
#> # ⁵​technology_share
135+
#> # A tibble: 3,200 × 11
136+
#> sector technology year region scenario_source name_abcd metric production
137+
#> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl>
138+
#> 1 automoti… electric 2020 global demo_2020 large au… proje… 713.
139+
#> 2 automoti… electric 2020 global demo_2020 large au… targe… 713.
140+
#> 3 automoti… electric 2020 global demo_2020 large au… targe… 713.
141+
#> 4 automoti… electric 2020 global demo_2020 large au… targe… 713.
142+
#> 5 automoti… electric 2020 global demo_2020 large au… proje… 535.
143+
#> 6 automoti… electric 2020 global demo_2020 large au… targe… 535.
144+
#> 7 automoti… electric 2020 global demo_2020 large au… targe… 535.
145+
#> 8 automoti… electric 2020 global demo_2020 large au… targe… 535.
146+
#> 9 automoti… electric 2020 global demo_2020 large au… proje… 690.
147+
#> 10 automoti… electric 2020 global demo_2020 large au… targe… 690.
148+
#> # ℹ 3,190 more rows
149+
#> # ℹ 3 more variables: technology_share <dbl>, scope <chr>,
150+
#> # percentage_of_initial_production_by_scope <dbl>
152151
```
153152

154153
### Utility Functions
@@ -175,41 +174,42 @@ loanbook_joined_to_abcd_scenario <- matched %>%
175174
# portfolio level
176175
loanbook_joined_to_abcd_scenario %>%
177176
summarize_weighted_production(scenario, tmsr, smsp, region)
178-
#> # A tibble: 702 × 9
179-
#> sector_abcd technology year scenario tmsr smsp region weighted…¹ weigh…²
180-
#> <chr> <chr> <int> <chr> <dbl> <dbl> <chr> <dbl> <dbl>
181-
#> 1 automotive electric 2020 cps 1 0 global 324592. 0.0380
182-
#> 2 automotive electric 2020 sds 1 0 global 324592. 0.0380
183-
#> 3 automotive electric 2020 sps 1 0 global 324592. 0.0380
184-
#> 4 automotive electric 2021 cps 1.12 0.00108 global 339656. 0.0393
185-
#> 5 automotive electric 2021 sds 1.16 0.00653 global 339656. 0.0393
186-
#> 6 automotive electric 2021 sps 1.14 0.00137 global 339656. 0.0393
187-
#> 7 automotive electric 2022 cps 1.24 0.00213 global 354720. 0.0406
188-
#> 8 automotive electric 2022 sds 1.32 0.0131 global 354720. 0.0406
189-
#> 9 automotive electric 2022 sps 1.29 0.00273 global 354720. 0.0406
190-
#> 10 automotive electric 2023 cps 1.35 0.00316 global 369784. 0.0419
191-
#> # … with 692 more rows, and abbreviated variable names ¹​weighted_production,
192-
#> # ²​weighted_technology_share
177+
#> # A tibble: 558 × 9
178+
#> sector_abcd technology year scenario tmsr smsp region
179+
#> <chr> <chr> <dbl> <chr> <dbl> <dbl> <chr>
180+
#> 1 automotive electric 2020 cps 1 0 global
181+
#> 2 automotive electric 2020 sds 1 0 global
182+
#> 3 automotive electric 2020 sps 1 0 global
183+
#> 4 automotive electric 2021 cps 1.12 0.00108 global
184+
#> 5 automotive electric 2021 sds 1.16 0.00653 global
185+
#> 6 automotive electric 2021 sps 1.14 0.00137 global
186+
#> 7 automotive electric 2022 cps 1.24 0.00213 global
187+
#> 8 automotive electric 2022 sds 1.32 0.0131 global
188+
#> 9 automotive electric 2022 sps 1.29 0.00273 global
189+
#> 10 automotive electric 2023 cps 1.35 0.00316 global
190+
#> # ℹ 548 more rows
191+
#> # ℹ 2 more variables: weighted_production <dbl>,
192+
#> # weighted_technology_share <dbl>
193193

194194
# company level
195195
loanbook_joined_to_abcd_scenario %>%
196196
summarize_weighted_production(scenario, tmsr, smsp, region, name_abcd)
197-
#> # A tibble: 9,036 × 10
198-
#> sector_a…¹ techn…² year scena…³ tmsr smsp region name_…⁴ weigh…⁵ weigh…⁶
199-
#> <chr> <chr> <int> <chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl>
200-
#> 1 automotive electr… 2020 cps 1 0 global toyota… 324592. 0.0380
201-
#> 2 automotive electr… 2020 sds 1 0 global toyota… 324592. 0.0380
202-
#> 3 automotive electr… 2020 sps 1 0 global toyota… 324592. 0.0380
203-
#> 4 automotive electr… 2021 cps 1.12 0.00108 global toyota… 339656. 0.0393
204-
#> 5 automotive electr… 2021 sds 1.16 0.00653 global toyota… 339656. 0.0393
205-
#> 6 automotive electr… 2021 sps 1.14 0.00137 global toyota… 339656. 0.0393
206-
#> 7 automotive electr… 2022 cps 1.24 0.00213 global toyota… 354720. 0.0406
207-
#> 8 automotive electr… 2022 sds 1.32 0.0131 global toyota… 354720. 0.0406
208-
#> 9 automotive electr… 2022 sps 1.29 0.00273 global toyota… 354720. 0.0406
209-
#> 10 automotive electr… 2023 cps 1.35 0.00316 global toyota… 369784. 0.0419
210-
#> # … with 9,026 more rows, and abbreviated variable names ¹​sector_abcd,
211-
#> # ²​technology, ³​scenario, ⁴​name_abcd, ⁵​weighted_production,
212-
#> # ⁶​weighted_technology_share
197+
#> # A tibble: 1,953 × 10
198+
#> sector_abcd technology year scenario tmsr smsp region name_abcd
199+
#> <chr> <chr> <dbl> <chr> <dbl> <dbl> <chr> <chr>
200+
#> 1 automotive electric 2020 cps 1 0 global large automotive co…
201+
#> 2 automotive electric 2020 cps 1 0 global large automotive co…
202+
#> 3 automotive electric 2020 cps 1 0 global large automotive co…
203+
#> 4 automotive electric 2020 cps 1 0 global large hdv company t…
204+
#> 5 automotive electric 2020 sds 1 0 global large automotive co…
205+
#> 6 automotive electric 2020 sds 1 0 global large automotive co…
206+
#> 7 automotive electric 2020 sds 1 0 global large automotive co…
207+
#> 8 automotive electric 2020 sds 1 0 global large hdv company t…
208+
#> 9 automotive electric 2020 sps 1 0 global large automotive co…
209+
#> 10 automotive electric 2020 sps 1 0 global large automotive co…
210+
#> # ℹ 1,943 more rows
211+
#> # ℹ 2 more variables: weighted_production <dbl>,
212+
#> # weighted_technology_share <dbl>
213213
```
214214

215215
[Get

cran-comments.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
## Test environments
2-
3-
* ubuntu 20.04 (local), R-release
4-
* ubuntu 18.04 (github actions), R 3.4, R 3.5, R-oldrel, R-release
5-
* macOS-latest (github actions), R-release, R-devel
6-
* windows-latest (github actions), R-release
7-
* win-builder, R-devel, R-release
8-
91
## R CMD check results
102

11-
0 errors | 0 warnings | 0 notes
12-
13-
## revdepcheck results
14-
15-
We checked 1 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
3+
0 errors | 0 warnings | 1 note
164

17-
* We saw 0 new problems
18-
* We failed to check 0 packages
5+
* Maintainer changed to Alex Axthelm while Jackson Hoffart is on extended leave.

man/r2dii.analysis-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/summarize_weighted_production.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)