Skip to content

Commit

Permalink
fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhoffa committed Mar 18, 2024
1 parent 4785a72 commit bca5f3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/join_abcd_scenario.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ join_abcd_scenario <- function(data,
abcd <- add_green_technologies_to_abcd(abcd, scenario)
}

abcd <- dplyr::filter(abcd, .data[["year"]] >= min(scenario[["year"]]))
scenario <- dplyr::filter(scenario, .data[["year"]] >= min(abcd[["year"]]))
abcd <- abcd %>%
arrange(.data[["year"]]) %>%
mutate(
.start_year = first(.data[["year"]]),
.by = c("name_company", "sector", "plant_location")
)

abcd_wide <- tidyr::pivot_wider(
abcd,
Expand Down Expand Up @@ -92,6 +96,10 @@ join_abcd_scenario <- function(data,
values_from = "value"
)

data <- data %>%
dplyr::filter(.data[["year"]] >= .data[[".start_year"]]) %>%
dplyr::mutate(.start_year = NULL)

out <- data %>%
mutate(plant_location = tolower(.data$plant_location)) %>%
inner_join(
Expand Down

0 comments on commit bca5f3f

Please sign in to comment.