-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: loanbook_demo
drops columns that are not crucial to r2dii.analysis
functions
#257
Comments
Note we have Maybe we should modify library(dplyr, warn.conflicts = FALSE)
library(r2dii.data)
library(r2dii.match)
loanbook <- r2dii.data::loanbook_demo
ald <- r2dii.data::ald_demo
crucial_lbk()
#> [1] "id_ultimate_parent"
#> [2] "name_ultimate_parent"
#> [3] "id_direct_loantaker"
#> [4] "name_direct_loantaker"
#> [5] "sector_classification_system"
#> [6] "sector_classification_direct_loantaker"
matched_crucial <- loanbook %>%
select(crucial_lbk()) %>%
match_name(ald)
try(prioritize(matched_crucial))
#> Error : Must have missing names:
#> `id_loan` Created on 2021-09-02 by the reprex package (v2.0.1) |
loanbook_demo
to only columns that are absolutely crucial to r2dii.analysis
functionsloanbook_demo
drops columns that are not crucial to r2dii.analysis
functions
Note that these seem to be the crucial columns: library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(r2dii.data)
library(r2dii.match)
library(r2dii.analysis)
library(r2dii.plot)
loanbook <- dplyr::select(
loanbook_demo,
c(
"id_loan",
"id_direct_loantaker",
"name_direct_loantaker",
# "id_intermediate_parent_1",
# "name_intermediate_parent_1",
"id_ultimate_parent",
"name_ultimate_parent",
"loan_size_outstanding",
"loan_size_outstanding_currency",
"loan_size_credit_limit",
"loan_size_credit_limit_currency",
"sector_classification_system",
# "sector_classification_input_type",
"sector_classification_direct_loantaker",
# "fi_type",
# "flag_project_finance_loan",
# "name_project",
"lei_direct_loantaker", # optional, but may be used as a `join_id`
"isin_direct_loantaker" # optional, but may be used as a `join_id`
)
)
matched <- loanbook |>
match_name(abcd_demo) |>
prioritize()
matched |>
target_market_share(abcd_demo, scenario_demo_2020, region_isos_demo) |>
filter(sector == "power", region == "global", technology == "renewablescap") |>
prep_trajectory() |>
plot_trajectory() matched |>
target_sda(
abcd_demo,
co2_intensity_scenario_demo,
region_isos = region_isos_demo
) |>
filter(sector == "cement", region == "global") |>
prep_emission_intensity() |>
plot_emission_intensity()
#> Warning: Removing rows in abcd where `emission_factor` is NA Created on 2024-03-20 with reprex v2.1.0 |
making this a priority so we can solve the connected issue #372 too |
Relates to feedback from a bank.
Since our data preparation guidance is to prepare input data exactly as
loanbook_demo
, we should either:loanbook_demo
, but indicate which are actually crucial totarget_market_share
andtarget_sda
OR
AB#10167
The text was updated successfully, but these errors were encountered: