Skip to content

Commit

Permalink
update knit and modernize the README (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhoffa authored Jan 30, 2024
1 parent 4a9017c commit 9c05568
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 62 deletions.
5 changes: 2 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![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)
[![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 -->
Expand All @@ -41,8 +40,8 @@ install.packages("r2dii.analysis")
Or install the development version of r2dii.analysis from GitHub with:

```r
# install.packages("devtools")
devtools::install_github("RMI-PACTA/r2dii.analysis")
# install.packages("pak")
pak::pak("RMI-PACTA/r2dii.analysis")
```

## Example
Expand Down
116 changes: 57 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lif
[![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)
[![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 -->
Expand All @@ -35,8 +33,8 @@ install.packages("r2dii.analysis")
Or install the development version of r2dii.analysis from GitHub with:

``` r
# install.packages("devtools")
devtools::install_github("RMI-PACTA/r2dii.analysis")
# install.packages("pak")
pak::pak("RMI-PACTA/r2dii.analysis")
```

## Example
Expand Down Expand Up @@ -73,20 +71,20 @@ matched %>%
region_isos = region_isos_demo
)
#> Warning: Removing rows in abcd where `emission_factor` is NA
#> # A tibble: 96 × 6
#> # A tibble: 220 × 6
#> sector year region scenario_source emission_factor_metric
#> <chr> <dbl> <chr> <chr> <chr>
#> 1 steel 2021 advanced economies demo_2020 projected
#> 2 steel 2021 global demo_2020 projected
#> 3 steel 2022 advanced economies demo_2020 projected
#> 4 steel 2022 global demo_2020 projected
#> 5 steel 2024 advanced economies demo_2020 projected
#> 6 steel 2024 global demo_2020 projected
#> 7 steel 2025 advanced economies demo_2020 projected
#> 8 steel 2025 global demo_2020 projected
#> 9 steel 2027 advanced economies demo_2020 projected
#> 10 steel 2027 global demo_2020 projected
#> # ℹ 86 more rows
#> 1 cement 2020 advanced economies demo_2020 projected
#> 2 cement 2020 developing asia demo_2020 projected
#> 3 cement 2020 global demo_2020 projected
#> 4 cement 2021 advanced economies demo_2020 projected
#> 5 cement 2021 developing asia demo_2020 projected
#> 6 cement 2021 global demo_2020 projected
#> 7 cement 2022 advanced economies demo_2020 projected
#> 8 cement 2022 developing asia demo_2020 projected
#> 9 cement 2022 global demo_2020 projected
#> 10 cement 2023 advanced economies demo_2020 projected
#> # ℹ 210 more rows
#> # ℹ 1 more variable: emission_factor_value <dbl>
```

Expand All @@ -100,20 +98,20 @@ matched %>%
scenario = scenario_demo_2020,
region_isos = region_isos_demo
)
#> # A tibble: 1,232 × 10
#> # A tibble: 792 × 10
#> sector technology year region scenario_source metric production
#> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl>
#> 1 automotive electric 2020 global demo_2020 projected 3664.
#> 2 automotive electric 2020 global demo_2020 target_cps 3664.
#> 3 automotive electric 2020 global demo_2020 target_sds 3664.
#> 4 automotive electric 2020 global demo_2020 target_sps 3664.
#> 5 automotive electric 2021 global demo_2020 projected 8472.
#> 6 automotive electric 2021 global demo_2020 target_cps 3845.
#> 7 automotive electric 2021 global demo_2020 target_sds 4766.
#> 8 automotive electric 2021 global demo_2020 target_sps 3894.
#> 9 automotive electric 2022 global demo_2020 projected 8436.
#> 10 automotive electric 2022 global demo_2020 target_cps 4023.
#> # ℹ 1,222 more rows
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl>
#> 1 automotive electric 2020 global demo_2020 projected 324592.
#> 2 automotive electric 2020 global demo_2020 target_cps 324592.
#> 3 automotive electric 2020 global demo_2020 target_sds 324592.
#> 4 automotive electric 2020 global demo_2020 target_sps 324592.
#> 5 automotive electric 2021 global demo_2020 projected 339656.
#> 6 automotive electric 2021 global demo_2020 target_cps 329191.
#> 7 automotive electric 2021 global demo_2020 target_sds 352505.
#> 8 automotive electric 2021 global demo_2020 target_sps 330435.
#> 9 automotive electric 2022 global demo_2020 projected 354720.
#> 10 automotive electric 2022 global demo_2020 target_cps 333693.
#> # ℹ 782 more rows
#> # ℹ 3 more variables: technology_share <dbl>, scope <chr>,
#> # percentage_of_initial_production_by_scope <dbl>
```
Expand All @@ -132,20 +130,20 @@ matched %>%
#> This will result in company-level results, weighted by the portfolio
#> loan size, which is rarely useful. Did you mean to set one of these
#> arguments to `FALSE`?
#> # A tibble: 3,200 × 11
#> # A tibble: 12,140 × 11
#> sector technology year region scenario_source name_abcd metric production
#> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl>
#> 1 automoti… electric 2020 global demo_2020 large au… proje… 713.
#> 2 automoti… electric 2020 global demo_2020 large au… targe… 713.
#> 3 automoti… electric 2020 global demo_2020 large au… targe… 713.
#> 4 automoti… electric 2020 global demo_2020 large au… targe… 713.
#> 5 automoti… electric 2020 global demo_2020 large au… proje… 535.
#> 6 automoti… electric 2020 global demo_2020 large au… targe… 535.
#> 7 automoti… electric 2020 global demo_2020 large au… targe… 535.
#> 8 automoti… electric 2020 global demo_2020 large au… targe… 535.
#> 9 automoti… electric 2020 global demo_2020 large au… proje… 690.
#> 10 automoti… electric 2020 global demo_2020 large au… targe… 690.
#> # ℹ 3,190 more rows
#> <chr> <chr> <int> <chr> <chr> <chr> <chr> <dbl>
#> 1 automoti… electric 2020 global demo_2020 Bernardi… proje… 324592.
#> 2 automoti… electric 2020 global demo_2020 Bernardi… targe… 324592.
#> 3 automoti… electric 2020 global demo_2020 Bernardi… targe… 324592.
#> 4 automoti… electric 2020 global demo_2020 Bernardi… targe… 324592.
#> 5 automoti… electric 2021 global demo_2020 Bernardi… proje… 339656.
#> 6 automoti… electric 2021 global demo_2020 Bernardi… targe… 329191.
#> 7 automoti… electric 2021 global demo_2020 Bernardi… targe… 352505.
#> 8 automoti… electric 2021 global demo_2020 Bernardi… targe… 330435.
#> 9 automoti… electric 2022 global demo_2020 Bernardi… proje… 354720.
#> 10 automoti… electric 2022 global demo_2020 Bernardi… targe… 333693.
#> # ℹ 12,130 more rows
#> # ℹ 3 more variables: technology_share <dbl>, scope <chr>,
#> # percentage_of_initial_production_by_scope <dbl>
```
Expand Down Expand Up @@ -174,9 +172,9 @@ loanbook_joined_to_abcd_scenario <- matched %>%
# portfolio level
loanbook_joined_to_abcd_scenario %>%
summarize_weighted_production(scenario, tmsr, smsp, region)
#> # A tibble: 558 × 9
#> # A tibble: 306 × 9
#> sector_abcd technology year scenario tmsr smsp region
#> <chr> <chr> <dbl> <chr> <dbl> <dbl> <chr>
#> <chr> <chr> <int> <chr> <dbl> <dbl> <chr>
#> 1 automotive electric 2020 cps 1 0 global
#> 2 automotive electric 2020 sds 1 0 global
#> 3 automotive electric 2020 sps 1 0 global
Expand All @@ -187,27 +185,27 @@ loanbook_joined_to_abcd_scenario %>%
#> 8 automotive electric 2022 sds 1.32 0.0131 global
#> 9 automotive electric 2022 sps 1.29 0.00273 global
#> 10 automotive electric 2023 cps 1.35 0.00316 global
#> # ℹ 548 more rows
#> # ℹ 296 more rows
#> # ℹ 2 more variables: weighted_production <dbl>,
#> # weighted_technology_share <dbl>

# company level
loanbook_joined_to_abcd_scenario %>%
summarize_weighted_production(scenario, tmsr, smsp, region, name_abcd)
#> # A tibble: 1,953 × 10
#> sector_abcd technology year scenario tmsr smsp region name_abcd
#> <chr> <chr> <dbl> <chr> <dbl> <dbl> <chr> <chr>
#> 1 automotive electric 2020 cps 1 0 global large automotive co
#> 2 automotive electric 2020 cps 1 0 global large automotive co
#> 3 automotive electric 2020 cps 1 0 global large automotive co
#> 4 automotive electric 2020 cps 1 0 global large hdv company t
#> 5 automotive electric 2020 sds 1 0 global large automotive co
#> 6 automotive electric 2020 sds 1 0 global large automotive co
#> 7 automotive electric 2020 sds 1 0 global large automotive co
#> 8 automotive electric 2020 sds 1 0 global large hdv company t
#> 9 automotive electric 2020 sps 1 0 global large automotive co
#> 10 automotive electric 2020 sps 1 0 global large automotive co
#> # ℹ 1,943 more rows
#> # A tibble: 4,005 × 10
#> sector_abcd technology year scenario tmsr smsp region name_abcd
#> <chr> <chr> <int> <chr> <dbl> <dbl> <chr> <chr>
#> 1 automotive electric 2020 cps 1 0 global Bernardi, Bernard
#> 2 automotive electric 2020 sds 1 0 global Bernardi, Bernard
#> 3 automotive electric 2020 sps 1 0 global Bernardi, Bernard
#> 4 automotive electric 2021 cps 1.12 0.00108 global Bernardi, Bernard
#> 5 automotive electric 2021 sds 1.16 0.00653 global Bernardi, Bernard
#> 6 automotive electric 2021 sps 1.14 0.00137 global Bernardi, Bernard
#> 7 automotive electric 2022 cps 1.24 0.00213 global Bernardi, Bernard
#> 8 automotive electric 2022 sds 1.32 0.0131 global Bernardi, Bernard
#> 9 automotive electric 2022 sps 1.29 0.00273 global Bernardi, Bernard
#> 10 automotive electric 2023 cps 1.35 0.00316 global Bernardi, Bernard
#> # ℹ 3,995 more rows
#> # ℹ 2 more variables: weighted_production <dbl>,
#> # weighted_technology_share <dbl>
```
Expand Down

0 comments on commit 9c05568

Please sign in to comment.