Skip to content

Commit

Permalink
Update aggregate_impacts.R
Browse files Browse the repository at this point in the history
Fixed line in aggregate_impacts.R that was preventing model averages from being calculated
  • Loading branch information
knoiva-indecon committed Nov 25, 2024
1 parent b3f6e38 commit 9922d0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/aggregate_impacts.R
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ aggregate_impacts <- function(

###### ** Model Averages ######
### Average values across models
modTypes0 <- df_agg[["model_type"]]
# modTypes0 <- df_agg[["model_type"]]
modTypes0 <- df_agg |> pull(model_type) |> unique() |> tolower()
has_modTypes <- modTypes0 |> length()
has_gcm <- has_modTypes |> ifelse("gcm" %in% modTypes0, FALSE)
if(aveModels & has_gcm){
Expand All @@ -438,7 +439,7 @@ aggregate_impacts <- function(
### Ungroup first
df_agg <- df_agg |> ungroup()
### Group by columns
group0 <- groupByCols |> get_matches(y=c("model", yearCol0), matches=F)
group0 <- groupByCols |> get_matches(y="model" |> c(yearCol0), matches=F)
group0 <- group0 |> c("year")
### Separate model types
df_gcm <- df_agg |> filter(model_type |> tolower() == "gcm")
Expand Down

0 comments on commit 9922d0c

Please sign in to comment.