From e41c6cd42ef08a8cbcf43ec8eb5a305c1fc633e0 Mon Sep 17 00:00:00 2001 From: dincerti Date: Wed, 24 Sep 2025 15:00:44 -0700 Subject: [PATCH 01/11] docs: update news with 0.5.6 --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index b9296ee0..b1e87d34 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## hesim 0.5.6 +Ensure compatibility with `ggplot v4.0.0`. + ## hesim 0.5.5 Minor updates to the `.Rd` files and tests to fix problem identified with the CRAN package checks. From df872218e39856f7e7308163f4718933bac64c79 Mon Sep 17 00:00:00 2001 From: dincerti Date: Wed, 24 Sep 2025 15:13:35 -0700 Subject: [PATCH 02/11] chore: increment package version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a12e6ea6..86dafafc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: hesim Type: Package Title: Health Economic Simulation Modeling and Decision Analysis -Version: 0.5.5 +Version: 0.5.6 Authors@R: c( person("Devin", "Incerti", , "devin.incerti@gmail.com", role = c("aut", "cre")), person("Jeroen P.", "Jansen", role = "aut"), From e5ada93d3ceae8141b0160baa134bd460fa1843a Mon Sep 17 00:00:00 2001 From: dincerti Date: Wed, 24 Sep 2025 15:55:26 -0700 Subject: [PATCH 03/11] fix: failing tests due to ggplot2 update --- R/plot.R | 53 +++++++++++++++++++++++++++++--------- tests/testthat/test-plot.R | 12 +++------ 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/R/plot.R b/R/plot.R index ddcc18f2..cdc6d62b 100644 --- a/R/plot.R +++ b/R/plot.R @@ -293,13 +293,27 @@ autoplot.survival <- function(object, labels = NULL, ci = FALSE, # Add confidence intervals if (ci) { if (ci_style == "line") { - p <- p + ggplot2::geom_ribbon(ggplot2::aes(x = t, ymin = lower, ymax = upper, - fill = .data[["curve"]]), - alpha = 0, linetype = "dashed") + p <- p + ggplot2::geom_ribbon( + ggplot2::aes( + x = t, + ymin = lower, + ymax = upper, + fill = .data[["curve"]] + ), + alpha = 0, linetype = "dashed", + show.legend = FALSE + ) } else if (ci_style == "ribbon") { - p <- p + ggplot2::geom_ribbon(ggplot2::aes(x = t, ymin = lower, ymax = upper, - fill = .data[["curve"]]), - alpha = geom_alpha) + p <- p + ggplot2::geom_ribbon( + ggplot2::aes( + x = t, + ymin = lower, + ymax = upper, + fill = .data[["curve"]] + ), + alpha = geom_alpha, + show.legend = FALSE + ) } p <- p + ggplot2::scale_fill_discrete("Curve") } @@ -373,13 +387,28 @@ autoplot.stateprobs <- function(object, labels = NULL, ci = FALSE, # Add confidence intervals if (ci) { if (ci_style == "line") { - p <- p + ggplot2::geom_ribbon(ggplot2::aes(x = t, ymin = lower, ymax = upper, - fill = .data[["strategy_id"]]), - alpha = 0, linetype = "dashed") + p <- p + ggplot2::geom_ribbon( + ggplot2::aes( + x = t, + ymin = lower, + ymax = upper, + fill = .data[["strategy_id"]] + ), + alpha = 0, + linetype = "dashed", + show.legend = FALSE + ) } else if (ci_style == "ribbon") { - p <- p + ggplot2::geom_ribbon(ggplot2::aes(x = t, ymin = lower, ymax = upper, - fill = .data[["strategy_id"]]), - alpha = geom_alpha) + p <- p + ggplot2::geom_ribbon( + ggplot2::aes( + x = t, + ymin = lower, + ymax = upper, + fill = .data[["strategy_id"]] + ), + alpha = geom_alpha, + show.legend = FALSE + ) } p <- p + ggplot2::scale_fill_discrete("Strategy") } diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 616469e1..7e2ea8ce 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,10 +1,6 @@ context("plot.R unit tests") library("data.table") -get_labs <- function(x) x$labels -if ("get_labs" %in% getNamespaceExports("ggplot2")) { - get_labs <- ggplot2::get_labs -} # Test autoplot method for survival -------------------------------------------- # Create mock survival object @@ -55,10 +51,10 @@ test_that("autoplot.survival() allows confidence intervals", { # Confidence intervals as lines p <- autoplot(surv, labels = labs, ci = TRUE) - expect_equal(get_labs(p)$fill, "Curve") + expect_equal(get_labs(p)$colour, "Curve") # Confidence intervals as ribbon p <- autoplot(surv, labels = labs, ci = TRUE, ci_style = "ribbon") - expect_equal(get_labs(p)$fill, "Curve") + expect_equal(get_labs(p)$colour, "Curve") }) test_that("autoplot.survival() works with patient weights", { @@ -98,10 +94,10 @@ test_that("autoplot.stateprobs() allows confidence intervals", { # Confidence intervals as lines p <- autoplot(stprobs, labels = labs, ci = TRUE) - expect_equal(get_labs(p)$fill, "Strategy") + expect_equal(get_labs(p)$colour, "Strategy") # Confidence intervals as ribbon p <- autoplot(stprobs, labels = labs, ci = TRUE, ci_style = "ribbon") - expect_equal(get_labs(p)$fill, "Strategy") + expect_equal(get_labs(p)$colour, "Strategy") }) From f22090c74c55a5024aa1df1984999c69bb3d0345 Mon Sep 17 00:00:00 2001 From: dincerti Date: Wed, 24 Sep 2025 16:01:10 -0700 Subject: [PATCH 04/11] fix: import ggplot2 --- tests/testthat/test-plot.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 7e2ea8ce..31852525 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,5 +1,6 @@ context("plot.R unit tests") library("data.table") +library("ggplot2") # Test autoplot method for survival -------------------------------------------- From 6e1da77fe64a58649457c31f583708aa3453b6b6 Mon Sep 17 00:00:00 2001 From: dincerti Date: Wed, 24 Sep 2025 16:30:17 -0700 Subject: [PATCH 05/11] fix: add get_labs function back --- tests/testthat/test-plot.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 31852525..2850a975 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,7 +1,10 @@ context("plot.R unit tests") library("data.table") -library("ggplot2") +get_labs <- function(x) x$labels +if ("get_labs" %in% getNamespaceExports("ggplot2")) { + get_labs <- ggplot2::get_labs +} # Test autoplot method for survival -------------------------------------------- # Create mock survival object From 47407e8d8e386f5b408c5920f14e104f502cd6db Mon Sep 17 00:00:00 2001 From: dincerti Date: Thu, 25 Sep 2025 13:23:13 -0700 Subject: [PATCH 06/11] build: ignore doxygen and CODEOWNERS in R build --- .Rbuildignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.Rbuildignore b/.Rbuildignore index 3cf63732..112f0bb5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,6 +10,7 @@ ^data-raw$ doxyfile DoxygenLayout.xml +^doxydoc$ .covrignore ^CRAN-RELEASE$ ^doc$ @@ -23,3 +24,4 @@ vignettes/benchmarks* ^vignettes/precompile.R ^CRAN-SUBMISSION$ ^Makefile$ +^CODEOWNERS$ From 664e72c9aade5f711a96f736010be61ab87955ec Mon Sep 17 00:00:00 2001 From: dincerti Date: Thu, 25 Sep 2025 13:54:40 -0700 Subject: [PATCH 07/11] docs: update CRAN comments --- cran-comments.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index ba293630..38e8c971 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,14 +1,6 @@ ## Release summary -The purpose of this release is to fix problems identified by the -CRAN checks. +The purpose of this release is to fix errors caused by the latest release of +ggplot2. -## Test environments -* Ubuntu 20.04.6 (on GitHub actions), R-devel -* Ubuntu 20.04.6 (on GitHub actions), R-release 4.4.1 -* Microsoft Windows Server 2022 10.0.20348 (on GitHub actions) R-release 4.4.1 -* win-builder (devel, release) -* macOS builder -* R-hub (atlas, gcc14, ubuntu-gcc12, linux (R-devel), macos (R-devel), macos-arm64 (R-devel), windows (R-devel)) - -## Win Builder R-devel results +## R CMD check results 0 errors | 0 warnings | 0 notes From 79f5d97fbf342812ad715bdd6fdd15bd77391b60 Mon Sep 17 00:00:00 2001 From: dincerti Date: Fri, 26 Sep 2025 12:34:57 -0700 Subject: [PATCH 08/11] docs: fix state probability plot in time inhomogeneous vignette --- vignettes/markov-inhomogeneous-cohort.Rmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vignettes/markov-inhomogeneous-cohort.Rmd b/vignettes/markov-inhomogeneous-cohort.Rmd index 4ee46150..61dc0cfa 100644 --- a/vignettes/markov-inhomogeneous-cohort.Rmd +++ b/vignettes/markov-inhomogeneous-cohort.Rmd @@ -331,11 +331,11 @@ set_labels(stateprob_summary, labels = labs, new_names = c("strategy_name", "state_name")) ggplot(stateprob_summary, aes(x = t, y = count_mean)) + geom_line(aes(col = strategy_name)) + - geom_ribbon(aes(x = t, ymin = count_lower, ymax = count_upper, - fill = strategy_name), alpha = .3) + facet_wrap(~state_name, scale = "free_y") + xlab("Year") + ylab("Count") + - scale_fill_discrete("Strategy") + scale_color_discrete("Strategy") + scale_colour_discrete(name = "Strategy") + + geom_ribbon(aes(x = t, ymin = count_lower, ymax = count_upper, + fill = strategy_name), alpha = .3, show.legend = FALSE) ``` ## Costs and QALYs From 5440cf81af6ad54de62ebfcdd7f2eca9a9223bdb Mon Sep 17 00:00:00 2001 From: dincerti Date: Sun, 28 Sep 2025 14:51:18 -0700 Subject: [PATCH 09/11] docs: wrap inlineCxxPlugin example in \dontrun{} --- DESCRIPTION | 2 +- R/utils.R | 3 +++ man/plugin.Rd | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 86dafafc..d0612f20 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -56,4 +56,4 @@ Suggests: truncnorm VignetteBuilder: knitr Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 diff --git a/R/utils.R b/R/utils.R index f6482d0b..2fc921a9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -381,6 +381,7 @@ get_n_samples.array <- function(x){ #' Code to use the hesim package inline. Not directly called by the user. #' @param ... arguments #' @examples +#' \dontrun{ #' library(Rcpp) #' sourceCpp(code=" #' // [[Rcpp::depends(hesim)]] @@ -393,6 +394,8 @@ get_n_samples.array <- function(x){ #' }") #' set.seed(12345) #' test_inline_gengamma(1.0, 1.0, 1.0) +#' } +#' #' @keywords internal #' @rdname plugin inlineCxxPlugin <- function(...) { diff --git a/man/plugin.Rd b/man/plugin.Rd index 9f0d879d..d55a2536 100644 --- a/man/plugin.Rd +++ b/man/plugin.Rd @@ -13,6 +13,7 @@ inlineCxxPlugin(...) Code to use the hesim package inline. Not directly called by the user. } \examples{ + \dontrun{ library(Rcpp) sourceCpp(code=" // [[Rcpp::depends(hesim)]] @@ -25,5 +26,7 @@ Code to use the hesim package inline. Not directly called by the user. }") set.seed(12345) test_inline_gengamma(1.0, 1.0, 1.0) + } + } \keyword{internal} From e5880975713f169e39bca2002007ae2cc316e82c Mon Sep 17 00:00:00 2001 From: dincerti Date: Sun, 28 Sep 2025 14:59:05 -0700 Subject: [PATCH 10/11] docs: use working data.table link --- vignettes/intro.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 8a125414..23ba0948 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -229,7 +229,7 @@ n_samples <- 1000 ``` ### Disease model -The disease model is constructed as a function of the fitted multi-state model (using the stored regression coefficients) and input data. The input data must be an object of class `expanded_hesim_data`, which is a [`data.table`](https://rdatatable.gitlab.io/data.table/) containing the covariates for the statistical model. In our multi-state model, each row is a unique treatment strategy, patient, and health-state transition. +The disease model is constructed as a function of the fitted multi-state model (using the stored regression coefficients) and input data. The input data must be an object of class `expanded_hesim_data`, which is a [`data.table`](https://github.com/Rdatatable/data.table) containing the covariates for the statistical model. In our multi-state model, each row is a unique treatment strategy, patient, and health-state transition. An `expanded_hesim_data` object can be created by expanding an object of class `hesim_data` using `expand.hesim_data()`. From a06e39db81a46f825faa07a8cac38bfdfd791318 Mon Sep 17 00:00:00 2001 From: dincerti Date: Sun, 28 Sep 2025 15:13:52 -0700 Subject: [PATCH 11/11] docs: update CRAN comments --- cran-comments.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 38e8c971..c3e88417 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,9 @@ ## Release summary The purpose of this release is to fix errors caused by the latest release of -ggplot2. +ggplot2. This is a resubmission that: + +1. Updates a broken link for the data.table website. +2. Ensures all examples complete in under 10 seconds during CRAN checks. ## R CMD check results 0 errors | 0 warnings | 0 notes