summarize_weighted_production: Summaries based on the weight of each loan per sector per...

View source: R/summarize_weighted_production.R

summarize_weighted_productionR Documentation

Summaries based on the weight of each loan per sector per year

Description

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.

Usage

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_abcd_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_abcd_scenario().

Other utility functions: join_abcd_scenario()

Examples


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

loanbook <- head(loanbook_demo, 150)
abcd <- head(abcd_demo, 100)
master <- loanbook %>%
  match_name(abcd) %>%
  prioritize() %>%
  join_abcd_scenario(
    abcd = abcd,
    scenario = scenario_demo_2020,
    region_isos = region_isos_demo
    ) %>%
  dplyr::filter(production != 0)

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)


r2dii.analysis documentation built on May 29, 2024, 11:47 a.m.