r2dii.analysis 0.1.0 is now on CRAN

This release includes a significant rework of the target_sda() function, and several bugfixes.

Jackson Hoffart https://github.com/jdhoffa
09-08-2020

Table of Contents


r2dii.analysis 0.1.0 is now on CRAN. r2dii.analysis provides analysis tools to help you study how financial assets align to climate scenarios.

This release signals that r2dii.analysis is now maturing. You can install it from CRAN with:


install.packages("r2dii.analysis")

Then use it with:


library(r2dii.analysis)

Let’s also load the rest of the r2dii suite and the package dplyr, which is not necessary but convenient.


library(r2dii.data)
library(r2dii.match)
library(dplyr)

All user-facing changes are listed in the changelog; here I’ll show the most important ones.

We fixed a bug in the dataset target_sda(); it now outputs targets calculated using the ald-adjusted scenarios.


match_result <- loanbook_demo %>%
  match_name(ald_demo) %>%
  prioritize()

match_result %>%
  target_sda(ald_demo, co2_intensity_scenario_demo)
#> # A tibble: 208 x 4
#>    sector      year emission_factor_metric emission_factor_value
#>    <chr>      <dbl> <chr>                                  <dbl>
#>  1 automotive  2002 projected                              0.228
#>  2 automotive  2003 projected                              0.226
#>  3 automotive  2004 projected                              0.224
#>  4 automotive  2005 projected                              0.222
#>  5 automotive  2006 projected                              0.220
#>  6 automotive  2007 projected                              0.218
#>  7 automotive  2008 projected                              0.216
#>  8 automotive  2009 projected                              0.214
#>  9 automotive  2010 projected                              0.212
#> 10 automotive  2011 projected                              0.210
#> # … with 198 more rows

We have also added the parameter weight_production to target_market_share(). This allows you to choose between outputting production values, weighted by relative loan size (weight_production = TRUE), or to output the actual raw company production values (weight_production = FALSE).


weighted <- TRUE

match_result %>%
  target_market_share(
    ald_demo,
    scenario_demo_2020,
    region_isos_demo,
    weight_production = weighted
  ) %>%
  filter(metric == "projected")
#> # A tibble: 234 x 8
#>    sector technology  year region scenario_source metric production
#>    <chr>  <chr>      <int> <chr>  <chr>           <chr>       <dbl>
#>  1 autom… electric    2020 global demo_2020       proje…    145942.
#>  2 autom… electric    2021 global demo_2020       proje…    148212.
#>  3 autom… electric    2022 global demo_2020       proje…    150481.
#>  4 autom… electric    2023 global demo_2020       proje…    152751.
#>  5 autom… electric    2024 global demo_2020       proje…    155020.
#>  6 autom… electric    2025 global demo_2020       proje…    157289.
#>  7 autom… electric    2026 global demo_2020       proje…    159559.
#>  8 autom… hybrid      2020 global demo_2020       proje…    141768.
#>  9 autom… hybrid      2021 global demo_2020       proje…    138687.
#> 10 autom… hybrid      2022 global demo_2020       proje…    135606.
#> # … with 224 more rows, and 1 more variable: technology_share <dbl>

raw <- FALSE

match_result %>%
  target_market_share(
    ald_demo,
    scenario_demo_2020,
    region_isos_demo,
    weight_production = raw
  ) %>%
  filter(metric == "projected")
#> # A tibble: 234 x 8
#>    sector technology  year region scenario_source metric production
#>    <chr>  <chr>      <int> <chr>  <chr>           <chr>       <dbl>
#>  1 autom… electric    2020 global demo_2020       proje…   6630404.
#>  2 autom… electric    2021 global demo_2020       proje…   6731628.
#>  3 autom… electric    2022 global demo_2020       proje…   6832852.
#>  4 autom… electric    2023 global demo_2020       proje…   6934075.
#>  5 autom… electric    2024 global demo_2020       proje…   7035299.
#>  6 autom… electric    2025 global demo_2020       proje…   7136523.
#>  7 autom… electric    2026 global demo_2020       proje…   7237746.
#>  8 autom… hybrid      2020 global demo_2020       proje…   7009476.
#>  9 autom… hybrid      2021 global demo_2020       proje…   6883774.
#> 10 autom… hybrid      2022 global demo_2020       proje…   6758072.
#> # … with 224 more rows, and 1 more variable: technology_share <dbl>

Acknowledgements

While this release includes commits from only a few of us (jdhoffa, maurolepore), it is thanks to ideas and feedback from many more colleagues at 2DII – particularly George Harris.

Citation

For attribution, please cite this work as

Hoffart (2020, Sept. 8). Data science at 2DII: r2dii.analysis 0.1.0 is now on CRAN. Retrieved from https://2degreesinvesting.github.io/posts/2020-09-08-r2dii-analysis-0-1-0-is-now-on-cran/

BibTeX citation

@misc{hoffart2020r2dii.analysis,
  author = {Hoffart, Jackson},
  title = {Data science at 2DII: r2dii.analysis 0.1.0 is now on CRAN},
  url = {https://2degreesinvesting.github.io/posts/2020-09-08-r2dii-analysis-0-1-0-is-now-on-cran/},
  year = {2020}
}