Skip to content

Commit f7a46f4

Browse files
authored
Prepare 0.1.10 (#339)
* groom NEWS.md * style * build README
1 parent 4b96b5b commit f7a46f4

File tree

3 files changed

+20
-37
lines changed

3 files changed

+20
-37
lines changed

NEWS.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# r2dii.analysis (development version)
22

3-
* `target_market_share()` now never calculates `smsp` targets that are less than
4-
zero (#336).
3+
* `target_market_share()` now sets all negative `smsp` targets to zero (#336).
54

6-
* `target_market_share()` now only outputs `sector` values that are present in
7-
all of `data`, `ald` and `scenario` (#329).
5+
* `target_market_share()` now only outputs `sector`s that are present in all
6+
input datasets (#329).
87

98
* `target_market_share()` now always adds targets for green technologies
109
(defined by `r2dii.data::green_or_brown`), even when not present in input
1110
`data` (#318 @Antoine-Lalechere).
1211

1312
* `target_market_share()` now correctly groups by `region` when calculating
14-
`technology_share` (#315 @Antoine-Lalechere).
15-
13+
`technology_share` (#315 @Antoine-Lalechere).
1614

1715
# r2dii.analysis 0.1.9
1816

R/join_ald_scenario.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ check_portfolio_ald_scenario <- function(valid_matches, ald, scenario) {
9797
}
9898

9999
add_green_technologies_to_ald <- function(data, scenario) {
100-
101100
green_techs <- r2dii.data::green_or_brown %>%
102101
filter(.data$green_or_brown == "green") %>%
103102
select(-.data$green_or_brown)
@@ -120,7 +119,6 @@ add_green_technologies_to_ald <- function(data, scenario) {
120119
mutate(production = 0)
121120

122121
dplyr::bind_rows(data, green_rows_to_add)
123-
124122
}
125123

126124
ald_columns <- function() {

README.md

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ to study how their capital allocation impacts the climate.
2626

2727
Before you install r2dii.analysis you may want to:
2828

29-
- [Try an rstudio.cloud project with this package already
29+
- [Try an rstudio.cloud project with this package already
3030
installed](https://rstudio.cloud/project/1424833).
31-
- [Learn how to minimize installation
31+
- [Learn how to minimize installation
3232
errors](https://gist.github.com/maurolepore/a0187be9d40aee95a43f20a85f4caed6#installation).
3333

3434
When you are ready, install the released version of r2dii.analysis from
@@ -50,34 +50,29 @@ issue?](https://2degreesinvesting.github.io/posts/2020-06-26-instructions-to-rai
5050

5151
## Example
5252

53-
- Use `library()` to attach the packages you need. r2dii.analysis does
53+
- Use `library()` to attach the packages you need. r2dii.analysis does
5454
not depend on the packages r2dii.data and r2dii.match; but we
55-
suggest you install them – with `install.packages(c("r2dii.data",
56-
"r2dii.match"))` – so you can reproduce our examples.
57-
58-
<!-- end list -->
55+
suggest you install them – with
56+
`install.packages(c("r2dii.data", "r2dii.match"))` – so you can
57+
reproduce our examples.
5958

6059
``` r
6160
library(r2dii.data)
6261
library(r2dii.match)
6362
library(r2dii.analysis)
6463
```
6564

66-
- Use `r2dii.match::match_name()` to identify matches between your
65+
- Use `r2dii.match::match_name()` to identify matches between your
6766
loanbook and the asset level data.
6867

69-
<!-- end list -->
70-
7168
``` r
7269
matched <- match_name(loanbook_demo, ald_demo) %>%
7370
prioritize()
7471
```
7572

7673
### Add Scenario Targets
7774

78-
- Use `target_sda()` to calculate SDA targets of CO2 emissions.
79-
80-
<!-- end list -->
75+
- Use `target_sda()` to calculate SDA targets of CO2 emissions.
8176

8277
``` r
8378
matched %>%
@@ -102,19 +97,17 @@ matched %>%
10297
#> # … with 153 more rows
10398
```
10499

105-
- Use `target_market_share` to calculate market-share scenario targets
100+
- Use `target_market_share` to calculate market-share scenario targets
106101
at the portfolio level:
107102

108-
<!-- end list -->
109-
110103
``` r
111104
matched %>%
112105
target_market_share(
113106
ald = ald_demo,
114107
scenario = scenario_demo_2020,
115108
region_isos = region_isos_demo
116109
)
117-
#> # A tibble: 3,692 x 8
110+
#> # A tibble: 2,334 x 8
118111
#> sector technology year region scenario_source metric production
119112
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl>
120113
#> 1 automotive electric 2020 global demo_2020 projected 324592.
@@ -127,12 +120,10 @@ matched %>%
127120
#> 8 automotive electric 2021 global demo_2020 target_sps 330435.
128121
#> 9 automotive electric 2022 global demo_2020 projected 354720.
129122
#> 10 automotive electric 2022 global demo_2020 target_cps 333693.
130-
#> # … with 3,682 more rows, and 1 more variable: technology_share <dbl>
123+
#> # … with 2,324 more rows, and 1 more variable: technology_share <dbl>
131124
```
132125

133-
- Or at the company level:
134-
135-
<!-- end list -->
126+
- Or at the company level:
136127

137128
``` r
138129
matched %>%
@@ -146,7 +137,7 @@ matched %>%
146137
#> This will result in company-level results, weighted by the portfolio
147138
#> loan size, which is rarely useful. Did you mean to set one of these
148139
#> arguments to `FALSE`?
149-
#> # A tibble: 14,804 x 9
140+
#> # A tibble: 32,946 x 9
150141
#> sector technology year region scenario_source name_ald metric production
151142
#> <chr> <chr> <int> <chr> <chr> <chr> <chr> <dbl>
152143
#> 1 automo… electric 2020 global demo_2020 toyota mot… proje… 324592.
@@ -159,19 +150,17 @@ matched %>%
159150
#> 8 automo… electric 2021 global demo_2020 toyota mot… targe… 330435.
160151
#> 9 automo… electric 2022 global demo_2020 toyota mot… proje… 354720.
161152
#> 10 automo… electric 2022 global demo_2020 toyota mot… targe… 333693.
162-
#> # … with 14,794 more rows, and 1 more variable: technology_share <dbl>
153+
#> # … with 32,936 more rows, and 1 more variable: technology_share <dbl>
163154
```
164155

165156
### Utility Functions
166157

167158
The `target_*()` functions provide shortcuts for common operations. They
168159
wrap some utility functions that you may also use directly:
169160

170-
- Use `join_ald_scenario()` to join a matched dataset to the relevant
161+
- Use `join_ald_scenario()` to join a matched dataset to the relevant
171162
scenario data, and to pick assets in the relevant regions.
172163

173-
<!-- end list -->
174-
175164
``` r
176165
loanbook_joined_to_ald_scenario <- matched %>%
177166
join_ald_scenario(
@@ -181,11 +170,9 @@ loanbook_joined_to_ald_scenario <- matched %>%
181170
)
182171
```
183172

184-
- Use `summarize_weighted_production()` with different grouping
173+
- Use `summarize_weighted_production()` with different grouping
185174
arguments to calculate scenario-targets:
186175

187-
<!-- end list -->
188-
189176
``` r
190177
# portfolio level
191178
loanbook_joined_to_ald_scenario %>%

0 commit comments

Comments
 (0)