@@ -26,9 +26,9 @@ to study how their capital allocation impacts the climate.
2626
2727Before 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
3434When 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
6160library(r2dii.data )
6261library(r2dii.match )
6362library(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
7269matched <- 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
8378matched %> %
@@ -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
111104matched %> %
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
138129matched %> %
@@ -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
167158The ` target_*() ` functions provide shortcuts for common operations. They
168159wrap 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
176165loanbook_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
191178loanbook_joined_to_ald_scenario %> %
0 commit comments