Skip to content

Commit

Permalink
only skip missing val check when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhoffa committed Mar 25, 2024
1 parent 2aee477 commit b1d5662
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion R/summarize_weighted_production.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,21 @@ summarize_unweighted_emission_factor <- function(data, ...) {
calculate_weighted_loan_metric <- function(data, metric) {

check_crucial_names(data, c(metric, "loan_weight"))
walk_("loan_weight", ~ check_no_value_is_missing(data, .x))

allowed_missing_vals <- c(
"production",
"production_target",
"technology_share",
"technology_share_target"
)

if (metric %in% allowed_missing_vals) {
no_missing_vals <- "loan_weight"
} else {
no_missing_vals <- c("loan_weight", metric)
}

walk_(no_missing_vals, ~ check_no_value_is_missing(data, .x))

data %>%
mutate(
Expand Down

0 comments on commit b1d5662

Please sign in to comment.