Skip to content

Commit

Permalink
wire in new internal functions and drop dependency on former packages (
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman authored Sep 17, 2024
1 parent 26c39d8 commit ef0d018
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 282 deletions.
5 changes: 0 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Imports:
glue,
htmlwidgets,
networkD3,
pacta.multi.loanbook.analysis,
pacta.multi.loanbook.plot,
plotly,
r2dii.analysis,
r2dii.data (>= 0.5.0),
Expand All @@ -57,9 +55,6 @@ Imports:
tidyr,
webshot,
withr
Remotes:
rmi-pacta/pacta.multi.loanbook.analysis,
rmi-pacta/pacta.multi.loanbook.plot
Depends:
R (>= 4.1.0)
License: MIT + file LICENSE
Expand Down
5 changes: 0 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(aggregate_alignment_loanbook_exposure)
export(calculate_company_aggregate_alignment_sda)
export(calculate_company_aggregate_alignment_tms)
export(calculate_company_tech_deviation)
export(plot_sankey)
export(plot_scatter)
export(plot_scatter_alignment_exposure)
Expand All @@ -14,7 +10,6 @@ export(prep_scatter)
export(prep_scatter_alignment_exposure)
export(prep_scatter_animated)
export(prep_timeline)
export(validate_data_has_expected_cols)
importFrom(dplyr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,.data)
Expand Down
12 changes: 7 additions & 5 deletions R/aggregate_alignment_loanbook_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#' inputs.
#'
#' @return NULL
#' @export
#'
#' @noRd

aggregate_alignment_loanbook_exposure <- function(data,
matched,
level = c("net", "bo_po"),
Expand Down Expand Up @@ -217,9 +219,9 @@ validate_input_data_aggregate_alignment_loanbook_exposure <- function(data,
matched,
group_vars,
.by = NULL) {
validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = data,
expected_columns = c(
cols = c(
group_vars,
"name_abcd",
"activity_unit",
Expand All @@ -228,9 +230,9 @@ validate_input_data_aggregate_alignment_loanbook_exposure <- function(data,
)
)

validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = matched,
expected_columns = c(
cols = c(
"id_loan",
"loan_size_outstanding",
"loan_size_outstanding_currency",
Expand Down
28 changes: 17 additions & 11 deletions R/calculate_company_alignment_metric.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#' is five years.
#'
#' @return NULL
#' @export
#'
#' @noRd

calculate_company_tech_deviation <- function(data,
technology_direction,
scenario_source = "geco_2021",
Expand Down Expand Up @@ -248,7 +250,9 @@ apply_bridge_technology_cap <- function(data,
#' disaggregated into buildout and phaseout technologies (`bo_po`).
#'
#' @return NULL
#' @export
#'
#' @noRd

calculate_company_aggregate_alignment_tms <- function(data,
scenario_source = "geco_2021",
scenario = "1.5c",
Expand Down Expand Up @@ -390,7 +394,9 @@ fill_missing_direction <- function(data) {
#' is five years.
#'
#' @return NULL
#' @export
#'
#' @noRd

calculate_company_aggregate_alignment_sda <- function(data,
scenario_source = "geco_2021",
scenario = "1.5c",
Expand Down Expand Up @@ -586,18 +592,18 @@ validate_input_args_calculate_company_tech_deviation <- function(scenario_source

validate_input_data_calculate_company_tech_deviation <- function(data,
technology_direction) {
validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = data,
expected_columns = c(
cols = c(
"sector", "technology", "year", "region", "scenario_source", "name_abcd",
"metric", "production", "technology_share", "scope",
"percentage_of_initial_production_by_scope"
)
)

validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = technology_direction,
expected_columns = c(
cols = c(
"scenario_source", "scenario", "sector", "technology", "region",
"directional_dummy"
)
Expand Down Expand Up @@ -650,9 +656,9 @@ validate_input_args_calculate_company_aggregate_alignment_tms <- function(scenar

validate_input_data_calculate_company_aggregate_alignment_tms <- function(data,
scenario) {
validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = data,
expected_columns = c(
cols = c(
"sector", "technology", "year", "region", "scenario_source", "name_abcd",
"projected", paste0("target_", scenario), "direction",
"total_tech_deviation", "activity_unit"
Expand Down Expand Up @@ -729,9 +735,9 @@ validate_input_args_calculate_company_aggregate_alignment_sda <- function(scenar


validate_input_data_calculate_company_aggregate_alignment_sda <- function(data) {
validate_data_has_expected_cols(
stop_if_not_expected_columns(
data = data,
expected_columns = c(
cols = c(
"sector", "year", "region", "scenario_source", "name_abcd",
"emission_factor_metric", "emission_factor_value"
)
Expand Down
Loading

0 comments on commit ef0d018

Please sign in to comment.