Skip to content

Commit

Permalink
ComDef: fix NA and Inf checker
Browse files Browse the repository at this point in the history
  • Loading branch information
klau506 committed Dec 9, 2024
1 parent 7ba8f2c commit db9215b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -4377,7 +4377,7 @@ do_bind_results <- function(GCAM_version = "v7.1") {
do_check_inf <- function(GCAM_version = "v7.1") {
# Check vetting results from SM
report_inf_summary <- report %>%
dplyr::filter(dplyr::across(`2005`:last_col(), ~ is.infinite(.)))
dplyr::filter(dplyr::if_any(`2005`:dplyr::last_col(), ~ is.infinite(.)))

# output
if (nrow(report_inf_summary) == 0) {
Expand Down Expand Up @@ -4407,7 +4407,7 @@ do_check_inf <- function(GCAM_version = "v7.1") {
do_check_na <- function(GCAM_version = "v7.1") {
# Check vetting results from SM
report_na_summary <- report %>%
dplyr::filter(dplyr::across(`2005`:last_col(), ~ is.na(.)))
dplyr::filter(dplyr::if_any(`2005`:last_col(), ~ is.na(.)))

# output
if (nrow(report_na_summary) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,8 @@ generate_report <- function(db_path = NULL, db_name = NULL, prj_name, scenarios
}
vetting_summary <<- vetting_summary
cat("To view the summary details, type:\n")
cat(' - `vetting_summary$`NA variables` to check for NA values\n')
cat(' - `vetting_summary$`Inf variables` to check for Inf values\n')
cat(' - `vetting_summary$`NA variables` to check for NA values\n')
cat(' - `vetting_summary$`Vetting variables` to check with historical values\n')
cat("\nYou can find a supporting vetting figure in: `output/figure/vetting.tiff`\n")
cat("==============================================================\n")
Expand Down

0 comments on commit db9215b

Please sign in to comment.