target_market_share: Add targets for production, using the market share approach

Description Usage Arguments Value Handling grouped data See Also Examples

View source: R/target_market_share.R

Description

This function calculates the portfolio-level production targets, as calculated using the market share approach applied to each relevant climate production forecast.

Usage

1
2
3
4
5
6
7
8
9
target_market_share(
  data,
  ald,
  scenario,
  region_isos = r2dii.data::region_isos,
  use_credit_limit = FALSE,
  by_company = FALSE,
  weight_production = TRUE
)

Arguments

data

A "data.frame" like the output of r2dii.match::prioritize().

ald

An asset level data frame like r2dii.data::ald_demo.

scenario

A scenario data frame like r2dii.data::scenario_demo_2020.

region_isos

A data frame like r2dii.data::region_isos (default).

use_credit_limit

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

by_company

Logical vector of length 1. FALSE defaults to outputting production_value at the portfolio-level. Set to TRUE to output production_value at the company-level.

weight_production

Logical vector of length 1. TRUE defaults to outputting production, weighted by relative loan-size. Set to FALSE to output the unweighted production values.

Value

A tibble including the summarized columns metric, production and technology_share. If by_company = TRUE, the output will also have the column name_ald.

Handling grouped data

This function ignores existing groups and outputs ungrouped data.

See Also

Other functions to calculate scenario targets: target_sda()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
installed <- requireNamespace("r2dii.data", quietly = TRUE) &&
  requireNamespace("r2dii.match", quietly = TRUE)
if (!installed) stop("Please install r2dii.match and r2dii.data")

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

loanbook <- head(loanbook_demo, 100)
ald <- head(ald_demo, 100)

matched <- loanbook %>%
  match_name(ald) %>%
  prioritize()

# Calculate targets at portfolio level
matched %>%
  target_market_share(
    ald = ald,
    scenario = scenario_demo_2020,
    region_isos = region_isos_demo
  )

# Calculate targets at company level
matched %>%
  target_market_share(
    ald = ald,
    scenario = scenario_demo_2020,
    region_isos = region_isos_demo,
    by_company = TRUE
  )

matched %>%
  target_market_share(
    ald = ald,
    scenario = scenario_demo_2020,
    region_isos = region_isos_demo,
    # Calculate unweighted targets
    weight_production = FALSE
  )

Example output

sh: 1: wc: Permission denied
Could not detect number of cores, defaulting to 1.
# A tibble: 210 x 8
   sector technology  year region scenario_source metric production
   <chr>  <chr>      <int> <chr>  <chr>           <chr>       <dbl>
 1 power  hydrocap    2020 global demo_2020       proje70721.
 2 power  hydrocap    2020 global demo_2020       corpo121032.
 3 power  hydrocap    2020 global demo_2020       targe70721.
 4 power  hydrocap    2020 global demo_2020       targe70721.
 5 power  hydrocap    2020 global demo_2020       targe70721.
 6 power  hydrocap    2021 global demo_2020       proje69694.
 7 power  hydrocap    2021 global demo_2020       corpo119274.
 8 power  hydrocap    2021 global demo_2020       targe70783.
 9 power  hydrocap    2021 global demo_2020       targe70819.
10 power  hydrocap    2021 global demo_2020       targe70789.
# … with 200 more rows, and 1 more variable: technology_share <dbl>
# A tibble: 210 x 9
   sector technology  year region scenario_source name_ald metric production
   <chr>  <chr>      <int> <chr>  <chr>           <chr>    <chr>       <dbl>
 1 power  hydrocap    2020 global demo_2020       aba hydproje70721.
 2 power  hydrocap    2020 global demo_2020       aba hydcorpo121032.
 3 power  hydrocap    2020 global demo_2020       aba hydtarge70721.
 4 power  hydrocap    2020 global demo_2020       aba hydtarge70721.
 5 power  hydrocap    2020 global demo_2020       aba hydtarge70721.
 6 power  hydrocap    2021 global demo_2020       aba hydproje69694.
 7 power  hydrocap    2021 global demo_2020       aba hydcorpo119274.
 8 power  hydrocap    2021 global demo_2020       aba hydtarge70778.
 9 power  hydrocap    2021 global demo_2020       aba hydtarge70812.
10 power  hydrocap    2021 global demo_2020       aba hydtarge70783.
# … with 200 more rows, and 1 more variable: technology_share <dbl>
Warning message:
You've supplied `by_company = TRUE` and `weight_production = TRUE`.
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: 210 x 8
   sector technology  year region scenario_source metric production
   <chr>  <chr>      <int> <chr>  <chr>           <chr>       <dbl>
 1 power  hydrocap    2020 global demo_2020       proje121032.
 2 power  hydrocap    2020 global demo_2020       corpo121032.
 3 power  hydrocap    2020 global demo_2020       targe121032.
 4 power  hydrocap    2020 global demo_2020       targe121032.
 5 power  hydrocap    2020 global demo_2020       targe121032.
 6 power  hydrocap    2021 global demo_2020       proje119274.
 7 power  hydrocap    2021 global demo_2020       corpo119274.
 8 power  hydrocap    2021 global demo_2020       targe121141.
 9 power  hydrocap    2021 global demo_2020       targe121205.
10 power  hydrocap    2021 global demo_2020       targe121151.
# … with 200 more rows, and 1 more variable: technology_share <dbl>

r2dii.analysis documentation built on July 9, 2021, 5:08 p.m.