From 4cdf91cf848d432e070d79a0c0cd44301e050838 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 14:16:29 +0000 Subject: [PATCH 1/5] Initial plan From a519cf2fd259243fce79614f81d6eb1f1cf2ac11 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 14:18:58 +0000 Subject: [PATCH 2/5] refactor convert_output scalar case_when branches Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com> --- R/convert_output.R | 12 ++---------- tests/testthat/test-convert_output.R | 6 ++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/R/convert_output.R b/R/convert_output.R index 5d145fb5..1f8a02d9 100644 --- a/R/convert_output.R +++ b/R/convert_output.R @@ -471,12 +471,7 @@ convert_output <- function( if ("sexes" %in% colnames(df3)) { df3 <- df3 |> # add in case if sexes is present and add sex as na if so - dplyr::mutate( - sex = dplyr::case_when( - any(grepl("^sexes$", colnames(df3))) ~ sexes, - TRUE ~ NA - ) - ) |> + dplyr::mutate(sex = if (any(grepl("^sexes$", colnames(df3)))) sexes else NA) |> dplyr::select(-sexes) } else { df3 <- dplyr::mutate(df3, sex = NA) @@ -1410,10 +1405,7 @@ convert_output <- function( } out_new <- Reduce(rbind, out_list) out_new <- out_new |> - dplyr::mutate(fleet = dplyr::case_when( - any(unique(out_new$fleet) %in% fleet_names) ~ fleet, - TRUE ~ fleet_names[fleet] - )) + dplyr::mutate(fleet = if (any(unique(out_new$fleet) %in% fleet_names)) fleet else fleet_names[fleet]) } else if (model %in% c("bam", "BAM")) { #### BAM #### # Extract values from BAM output - model file after following ADMB2R diff --git a/tests/testthat/test-convert_output.R b/tests/testthat/test-convert_output.R index 80f78616..fb0b0119 100644 --- a/tests/testthat/test-convert_output.R +++ b/tests/testthat/test-convert_output.R @@ -25,6 +25,12 @@ test_that("convert_output works for SS3", { expect_equal(dim(output)[2], 34) }) +test_that("convert_output does not emit scalar case_when deprecation warning", { + expect_no_warning(convert_output( + file = fs::path("fixtures", "ss3_models", "models", "Hake_2018", "Report.sso") + )) +}) + test_that("convert_output saves model ss3 hake output file", { dir.create(fs::path("fixtures", "ss3_models_converted", "Hake_2018"), recursive = TRUE) From 3726423098b63601432d7886a7a632d390c61551 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 19:14:53 +0000 Subject: [PATCH 3/5] refactor scalar case_when in plot_aa Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com> --- R/utils_plot.R | 5 +---- tests/testthat/test-utils_plot.R | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/R/utils_plot.R b/R/utils_plot.R index 3ee0f015..6bd9fa36 100644 --- a/R/utils_plot.R +++ b/R/utils_plot.R @@ -375,10 +375,7 @@ plot_aa <- function( dplyr::mutate( age = as.numeric(age), # zvar = .data[[z]], - zvar = dplyr::case_when( - proportional ~ sqrt(.data[[z]]), - TRUE ~ .data[[z]] - ) + zvar = if (proportional) sqrt(.data[[z]]) else .data[[z]] ) # Caclaulate x-axis breaks x_n_breaks <- axis_breaks(dat[[x]]) diff --git a/tests/testthat/test-utils_plot.R b/tests/testthat/test-utils_plot.R index 781c475b..dfe4e857 100644 --- a/tests/testthat/test-utils_plot.R +++ b/tests/testthat/test-utils_plot.R @@ -78,7 +78,7 @@ test_that("plot_aa and helper line builders return expected outputs", { group_var = "1" ) - proportional_plot <- plot_aa(aa_dat, proportional = TRUE) + expect_no_warning(proportional_plot <- plot_aa(aa_dat, proportional = TRUE)) expect_s3_class(proportional_plot, "gg") expect_equal(proportional_plot$theme$legend.position, "none") From 3c0bf52f67e4ee74f305c46cd24ff061c1d5cf6b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Aug 2026 13:17:33 +0000 Subject: [PATCH 4/5] Fix convert_output join warning on Windows release Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com> --- R/convert_output.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/convert_output.R b/R/convert_output.R index 1f8a02d9..a6d4b271 100644 --- a/R/convert_output.R +++ b/R/convert_output.R @@ -2364,7 +2364,14 @@ convert_output <- function( var_names_sheet <- var_names_sheet |> dplyr::select(-module_name) out_new <- dplyr::left_join(out_new, var_names_sheet, by = "label") } else { - out_new <- dplyr::left_join(out_new, var_names_sheet, by = c("module_name", "label")) + var_names_sheet <- var_names_sheet |> + dplyr::distinct(module_name, label, .keep_all = TRUE) + out_new <- dplyr::left_join( + out_new, + var_names_sheet, + by = c("module_name", "label"), + relationship = "many-to-one" + ) } out_new <- out_new |> dplyr::mutate(label = dplyr::case_when( From 5b04e38937d9f85de2558a5fd7e959b90bd3d51d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Aug 2026 19:00:29 +0000 Subject: [PATCH 5/5] Silence expected numeric coercion warning in convert_output Co-authored-by: Schiano-NOAA <125507018+Schiano-NOAA@users.noreply.github.com> --- R/convert_output.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/convert_output.R b/R/convert_output.R index 029089b8..8b36a2e5 100644 --- a/R/convert_output.R +++ b/R/convert_output.R @@ -662,7 +662,7 @@ convert_output <- function( label == "f" ~ "fishing_mortality", TRUE ~ label ), - estimate = as.numeric(estimate) + estimate = suppressWarnings(as.numeric(estimate)) # dplyr::if_else( # grepl("-|_", as.numeric(estimate)), # NA,