From 170d4b0d60a3514607a962d32d2a848baaf298e9 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Fri, 15 Mar 2024 11:40:30 +0100 Subject: [PATCH] only add green technologies if not already present (#480) --- R/join_abcd_scenario.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/join_abcd_scenario.R b/R/join_abcd_scenario.R index 3af8f89c..6c0d6fc2 100644 --- a/R/join_abcd_scenario.R +++ b/R/join_abcd_scenario.R @@ -103,6 +103,11 @@ add_green_technologies_to_abcd <- function(data, scenario) { unique() %>% inner_join(increasing_techs, by = c("sector", "technology")) + increasing_techs_not_in_abcd <- dplyr::filter( + increasing_techs_in_scenario, + !(technology %in% unique(data$technology)) + ) + green_rows_to_add <- data %>% group_by( .data$name_company, @@ -113,7 +118,7 @@ add_green_technologies_to_abcd <- function(data, scenario) { ) %>% summarize() %>% left_join( - increasing_techs_in_scenario, + increasing_techs_not_in_abcd, by = "sector", relationship = "many-to-many" ) %>%