Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
^data-raw$
doxyfile
DoxygenLayout.xml
^doxydoc$
.covrignore
^CRAN-RELEASE$
^doc$
Expand All @@ -23,3 +24,4 @@ vignettes/benchmarks*
^vignettes/precompile.R
^CRAN-SUBMISSION$
^Makefile$
^CODEOWNERS$
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -56,4 +56,4 @@ Suggests:
truncnorm
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
53 changes: 41 additions & 12 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down
3 changes: 3 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)]]
Expand All @@ -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(...) {
Expand Down
15 changes: 5 additions & 10 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
## 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. This is a resubmission that:

## 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))
1. Updates a broken link for the data.table website.
2. Ensures all examples complete in under 10 seconds during CRAN checks.

## Win Builder R-devel results
## R CMD check results
0 errors | 0 warnings | 0 notes
3 changes: 3 additions & 0 deletions man/plugin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,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", {
Expand Down Expand Up @@ -98,10 +98,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")

})

Expand Down
2 changes: 1 addition & 1 deletion vignettes/intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.

Expand Down
6 changes: 3 additions & 3 deletions vignettes/markov-inhomogeneous-cohort.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading