Based on on the weight of each loan per sector per year, summarize_weighted_production() and summarize_weighted_percent_change() summarize the production and percent-change, respectively.

summarize_weighted_production(data, ..., use_credit_limit = FALSE)

summarize_weighted_percent_change(data, ..., use_credit_limit = FALSE)

Arguments

data

A data frame like the output of join_ald_scenario().

...

Variables to group by.

use_credit_limit

Logical vector of length 1. FALSE defaults to using the column loan_size_outstanding. Set to TRUE to instead use the column loan_size_credit_limit.

Value

A tibble with the same groups as the input (if any) and columns: sector, technology, and year; and weighted_production or weighted_production for summarize_weighted_production() and summarize_weighted_percent_change(), respectively.

Warning

The percent-change analysis excludes companies with 0 production. percent-change is undefined for companies that have no initial production; including such companies would cause percent-change percentage to be infinite, which is wrong.

See also

join_ald_scenario().

Other utility functions: join_ald_scenario()

Examples

installed <- requireNamespace("r2dii.data", quietly = TRUE) && requireNamespace("r2dii.match", quietly = TRUE) if (installed) { library(r2dii.data) library(r2dii.match) loanbook <- head(loanbook_demo, 150) ald <- head(ald_demo, 100) master <- loanbook %>% match_name(ald) %>% prioritize() %>% join_ald_scenario( ald = ald, scenario = scenario_demo_2020, region_isos = region_isos_demo ) summarize_weighted_production(master) summarize_weighted_production(master, use_credit_limit = TRUE) summarize_weighted_percent_change(master) summarize_weighted_percent_change(master, use_credit_limit = TRUE) }
#> # A tibble: 42 × 4 #> sector_ald technology year weighted_percent_change #> <chr> <chr> <int> <dbl> #> 1 power hydrocap 2020 0 #> 2 power hydrocap 2021 -0.663 #> 3 power hydrocap 2022 -1.33 #> 4 power hydrocap 2023 -1.99 #> 5 power hydrocap 2024 -2.65 #> 6 power hydrocap 2025 -3.32 #> 7 power hydrocap 2026 -3.98 #> 8 power hydrocap 2027 -4.64 #> 9 power hydrocap 2028 -5.31 #> 10 power hydrocap 2029 -5.97 #> # … with 32 more rows