diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index b6a9b8d..bdb5247 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -57,6 +57,13 @@ jobs: extra-packages: any::rcmdcheck needs: check + ## Due to the RSPM setting opemp improperly circa 2026-06-30 + - name: Install gower from source (macOS only) + if: runner.os == 'macOS' + run: | + install.packages("gower", type = "source") + shell: Rscript {0} + - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true diff --git a/NEWS.md b/NEWS.md index 7105523..1591b41 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # probably (development version) +* Fixed `cal_plot_breaks()`, `cal_plot_logistic()`, and `cal_plot_windowed()` so that plots of tuning results with more than one model configuration can be rendered. The grouping column was dropped before the plot was faceted (#202). + # probably 1.2.0 * Add `required_pkgs()` methods to `int_conformal_cv()`, `int_conformal_full()`, `int_conformal_quantile()`, and `int_conformal_split()`. (#190) diff --git a/R/cal-plot-breaks.R b/R/cal-plot-breaks.R index e5b6490..3d04308 100644 --- a/R/cal-plot-breaks.R +++ b/R/cal-plot-breaks.R @@ -219,7 +219,7 @@ cal_plot_breaks_impl <- function( .data = .data, truth = !!truth, estimate = !!estimate, - group = !!group, + .by = !!group, num_breaks = num_breaks, conf_level = conf_level, event_level = event_level diff --git a/R/cal-plot-logistic.R b/R/cal-plot-logistic.R index ae994dd..1190b72 100644 --- a/R/cal-plot-logistic.R +++ b/R/cal-plot-logistic.R @@ -161,7 +161,7 @@ cal_plot_logistic_impl <- function( .data = .data, truth = !!truth, estimate = !!estimate, - group = !!group, + .by = !!group, conf_level = conf_level, event_level = event_level, smooth = smooth diff --git a/R/cal-plot-windowed.R b/R/cal-plot-windowed.R index 8dbadc9..34115a2 100644 --- a/R/cal-plot-windowed.R +++ b/R/cal-plot-windowed.R @@ -179,7 +179,7 @@ cal_plot_windowed_impl <- function( .data = .data, truth = !!truth, estimate = !!estimate, - group = !!group, + .by = !!group, window_size = window_size, step_size = step_size, conf_level = conf_level, diff --git a/tests/testthat/_snaps/cal-plot-regression.md b/tests/testthat/_snaps/cal-plot-regression.md index 76cfad8..ee50b88 100644 --- a/tests/testthat/_snaps/cal-plot-regression.md +++ b/tests/testthat/_snaps/cal-plot-regression.md @@ -21,11 +21,15 @@ $slope [1] "slope" - $colour - [1] "colour" - $fill [1] "fill" + attr(,"fallback") + [1] TRUE + + $colour + [1] "colour" + attr(,"fallback") + [1] TRUE $alt [1] "" @@ -54,11 +58,15 @@ $slope [1] "slope" - $colour - [1] "colour" - $fill [1] "fill" + attr(,"fallback") + [1] TRUE + + $colour + [1] "colour" + attr(,"fallback") + [1] TRUE $alt [1] "" @@ -87,11 +95,15 @@ $slope [1] "slope" - $colour - [1] "colour" - $fill [1] "fill" + attr(,"fallback") + [1] TRUE + + $colour + [1] "colour" + attr(,"fallback") + [1] TRUE $alt [1] "" @@ -120,11 +132,15 @@ $slope [1] "slope" - $colour - [1] "colour" - $fill [1] "fill" + attr(,"fallback") + [1] TRUE + + $colour + [1] "colour" + attr(,"fallback") + [1] TRUE $alt [1] "" @@ -153,11 +169,15 @@ $slope [1] "slope" - $colour - [1] "colour" - $fill [1] "fill" + attr(,"fallback") + [1] TRUE + + $colour + [1] "colour" + attr(,"fallback") + [1] TRUE $alt [1] "" diff --git a/tests/testthat/test-cal-plot-breaks.R b/tests/testthat/test-cal-plot-breaks.R index 62d7fa4..b3fb6d6 100644 --- a/tests/testthat/test-cal-plot-breaks.R +++ b/tests/testthat/test-cal-plot-breaks.R @@ -167,6 +167,13 @@ test_that("don't facet if there is only one .config", { expect_s3_class(res_breaks, "ggplot") }) +test_that("tune_results plot can be built - facet variable is in the data (#202)", { + res_breaks <- cal_plot_breaks(testthat_cal_binary()) + + expect_true(".config" %in% names(res_breaks$data)) + expect_no_error(ggplot2::ggplot_build(res_breaks)) +}) + test_that("custom names for cal_plot_breaks()", { data(segment_logistic) segment_logistic_1 <- dplyr::rename(segment_logistic, good_prob = .pred_good) diff --git a/tests/testthat/test-cal-plot-logistic.R b/tests/testthat/test-cal-plot-logistic.R index 75f8968..e7ce40e 100644 --- a/tests/testthat/test-cal-plot-logistic.R +++ b/tests/testthat/test-cal-plot-logistic.R @@ -182,6 +182,13 @@ test_that("don't facet if there is only one .config", { expect_s3_class(res_logistic, "ggplot") }) +test_that("tune_results plot can be built - facet variable is in the data (#202)", { + res_logistic <- cal_plot_logistic(testthat_cal_binary()) + + expect_true(".config" %in% names(res_logistic$data)) + expect_no_error(ggplot2::ggplot_build(res_logistic)) +}) + test_that("Groups are respected", { preds <- segment_logistic |> diff --git a/tests/testthat/test-cal-plot-windowed.R b/tests/testthat/test-cal-plot-windowed.R index e9243ab..fdb814f 100644 --- a/tests/testthat/test-cal-plot-windowed.R +++ b/tests/testthat/test-cal-plot-windowed.R @@ -113,6 +113,13 @@ test_that("don't facet if there is only one .config", { expect_s3_class(res_windowed, "ggplot") }) +test_that("tune_results plot can be built - facet variable is in the data (#202)", { + res_windowed <- cal_plot_windowed(testthat_cal_binary()) + + expect_true(".config" %in% names(res_windowed$data)) + expect_no_error(ggplot2::ggplot_build(res_windowed)) +}) + test_that("Groupings that may not match work", { model <- glm(Class ~ .pred_good, segment_logistic, family = "binomial")