From 7d6992f581071051cdeee3b5fd3fbe06cd9fa239 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Fri, 16 Feb 2024 08:59:42 +0000 Subject: [PATCH 1/6] update NEWS --- NEWS.md | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 438f6a62..1f7c537d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ _February 2024_ Patch fixing small bugs from last CRAN release. +* Moved `{voi}` package to Suggests in DESCRIPTION and added `requireNamespace()` in `evppi()` to avoid error when not installed (e.g. on CRAN) (f3e3e3e) * Converted help documentation in `man-roxygen` folder to md (cf858b1) * bugfix: line width in CEAC plot. `{ggplot2}` changed in version 3 to `linewidth` from `size` argument and had only changed some of the code. Updated to `scale_linewidth_manual()`. (60bea9c) * Using `testdata` folder `{testthat}` unit tests. (cbce0fa) diff --git a/README.md b/README.md index 4d6892d7..ef78becc 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ > Perform Bayesian Cost-Effectiveness Analysis in R. -:rocket: **Version 2.4.5 in development now!** [Check out the release notes here](https://github.com/n8thangreen/BCEA/releases). +:rocket: **Version 2.4.6 in development now!** [Check out the release notes here](https://github.com/n8thangreen/BCEA/releases). ## Contents From 3d8a7703bb48e62adefabb525efc8f8569fee566 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Thu, 22 Feb 2024 17:46:47 +0000 Subject: [PATCH 2/6] generalised input argument to ceplane.plot for wtp label for ggplot * still need to test * refactor for base plot version --- R/ceplane.plot.R | 1 - R/ceplane_geom_params.R | 4 ++-- R/ceplane_ggplot_params.R | 3 --- R/ceplane_plot_graph.R | 6 ++---- R/prep_ceplane_params.R | 27 +++++++++++++++++++++------ 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/R/ceplane.plot.R b/R/ceplane.plot.R index a62e9bd1..8fa1ccd0 100644 --- a/R/ceplane.plot.R +++ b/R/ceplane.plot.R @@ -120,7 +120,6 @@ ceplane.plot.bcea <- function(he, } else if (is_ggplot(graph)) { ceplane_plot_ggplot(he, - wtp, pos_legend = pos, graph_params, ...) diff --git a/R/ceplane_geom_params.R b/R/ceplane_geom_params.R index 650cdb6c..f90fb858 100644 --- a/R/ceplane_geom_params.R +++ b/R/ceplane_geom_params.R @@ -25,14 +25,14 @@ ceplane_geom_params <- function(...) { names(extra_params) %in% c("area_include", "area_color")] names(polygon_params) <- gsub("area_", "", names(polygon_params)) - wtp_params <- + label.pos <- extra_params[ names(extra_params) %in% "label.pos"] modifyList( list( area_include = TRUE, - wtp_label.pos = wtp_params), + label.pos = label.pos), list( icer = icer_params, point = point_params, diff --git a/R/ceplane_ggplot_params.R b/R/ceplane_ggplot_params.R index 5a57d6ee..6ab5bd80 100644 --- a/R/ceplane_ggplot_params.R +++ b/R/ceplane_ggplot_params.R @@ -2,7 +2,6 @@ #' CE-plane ggplot Parameters #' #' @template args-he -#' @param wtp Willingness to pay #' @param pos_legend Position of legend #' @param graph_params Other graphical parameters #' @param ... Additional arguments @@ -11,7 +10,6 @@ #' @keywords internal #' ceplane_ggplot_params <- function(he, - wtp, pos_legend, graph_params, ...) { @@ -33,7 +31,6 @@ ceplane_ggplot_params <- function(he, y = graph_params$ylim[1], hjust = "inward", vjust = "inward", - label = paste0(" k = ", format(wtp, digits = 6), "\n"), size = convert_pts_to_mm(1), colour = "black"), icer = list( diff --git a/R/ceplane_plot_graph.R b/R/ceplane_plot_graph.R index cbf5e9a3..ca3bf676 100644 --- a/R/ceplane_plot_graph.R +++ b/R/ceplane_plot_graph.R @@ -138,10 +138,8 @@ ceplane_plot_base <- function(he, ...) { #' theme = ggplot2::theme_linedraw()) #' ceplane_plot_ggplot.bcea <- function(he, - wtp = 25000, pos_legend, graph_params, ...) { - # single long format for ggplot data delta_ce <- merge( @@ -160,7 +158,7 @@ ceplane_plot_ggplot.bcea <- function(he, by = c("sim", "comparison")) plot_params <- - ceplane_ggplot_params(he, wtp, pos_legend, graph_params, ...) + ceplane_ggplot_params(he, pos_legend, graph_params, ...) theme_add <- purrr::keep(list(...), is.theme) @@ -194,7 +192,7 @@ ceplane_plot_ggplot.bcea <- function(he, list(title = plot_params$title, x = plot_params$xlab, y = plot_params$ylab)) + - do.call(geom_abline, c(slope = wtp, plot_params$line)) + + do.call(geom_abline, c(slope = plot_params$wtp_value, plot_params$line)) + do.call(geom_point, plot_params$icer) + do.call(annotate, plot_params$wtp) + do.call(annotate, plot_params$icer_txt) + diff --git a/R/prep_ceplane_params.R b/R/prep_ceplane_params.R index 816009f7..dd5f6829 100644 --- a/R/prep_ceplane_params.R +++ b/R/prep_ceplane_params.R @@ -5,7 +5,7 @@ #' parameters with defaults. #' #' @template args-he -#' @param wtp Willingness-to-pay +#' @param wtp_params Willingness-to-pay threshold. This can be a single value or a list. #' @param ... Additional arguments #' @importFrom grDevices grey.colors #' @@ -13,11 +13,14 @@ #' @export #' @keywords internal #' -prep_ceplane_params <- function(he, wtp, ...) { +prep_ceplane_params <- function(he, wtp_params, ...) { graph_params <- list(...) - ##TODO: back-compatibility helper.. + # back compatibility + if (!is.list(wtp_params)) { + wtp_params <- list(value = wtp_params) + } intervs_in_title <- paste("\n", @@ -32,8 +35,8 @@ prep_ceplane_params <- function(he, wtp, ...) { ifelse(he$n_comparisons == 1, #he$change_comp, yes = intervs_in_title, no = "")) - - axes_lim <- xy_params(he, wtp, graph_params) + browser() + axes_lim <- xy_params(he, wtp_params$value, graph_params) default_params <- list(xlab = "Incremental effectiveness", @@ -47,6 +50,8 @@ prep_ceplane_params <- function(he, wtp, ...) { alpha = 1), size = 0.35, shape = rep(20, he$n_comparisons)), + wtp = list( + value = 25000), area_include = TRUE, ICER_size = 2, area = list( @@ -54,6 +59,16 @@ prep_ceplane_params <- function(he, wtp, ...) { col = "grey95"), ref_first = TRUE) - modifyList(default_params, graph_params) + out <- + modifyList(default_params, graph_params) |> + modifyList(list(wtp = wtp_params)) + + out$wtp$label <- paste0(" k = ", format(out$wtp$value, digits = 6), "\n") + + # move out of wtp list so can pass straight to geom + out$wtp_value <- out$wtp$value + out$wtp$value <- NULL + + out } From d4467e61044109f3d1c6a4e9352d9ec15a2b44d9 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Thu, 22 Feb 2024 20:16:44 +0000 Subject: [PATCH 3/6] fixed bug with wtp in polygon_params() --- .Rbuildignore | 1 + R/ceplane.plot.R | 2 +- R/ceplane_base_params.R | 2 +- R/ceplane_base_params_xxx.R | 4 +++- R/ceplane_ggplot_params.R | 4 ++-- R/ceplane_plot_graph.R | 1 + R/prep_ceplane_params.R | 4 ++-- cran-comments.md | 2 +- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 7bb08579..4abe8285 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -25,3 +25,4 @@ ^CONTRIBUTING\.md$ ^revdep$ ^CRAN-SUBMISSION$ +^CITATION\.cff$ diff --git a/R/ceplane.plot.R b/R/ceplane.plot.R index 8fa1ccd0..70e8989a 100644 --- a/R/ceplane.plot.R +++ b/R/ceplane.plot.R @@ -103,7 +103,7 @@ ceplane.plot.bcea <- function(he, pos = c(0, 1), graph = c("base", "ggplot2", "plotly"), ...) { - + browser() graph <- match.arg(graph) he <- setComparisons(he, comparison) diff --git a/R/ceplane_base_params.R b/R/ceplane_base_params.R index 02737f4c..a3c189c5 100644 --- a/R/ceplane_base_params.R +++ b/R/ceplane_base_params.R @@ -8,7 +8,7 @@ ceplane_base_params <- function(he, c(list( setup = setup_params(graph_params), points = points_params(graph_params), - polygon = polygon_params(graph_params, wtp), + polygon = polygon_params(graph_params), k_txt = k_text(graph_params, wtp), wtp = wtp, ref_first = graph_params$ref_first), diff --git a/R/ceplane_base_params_xxx.R b/R/ceplane_base_params_xxx.R index 80cb4ffc..8ece3392 100644 --- a/R/ceplane_base_params_xxx.R +++ b/R/ceplane_base_params_xxx.R @@ -17,7 +17,9 @@ setup_params <- function(graph_params) { #' @keywords dplot #' -polygon_params <- function(graph_params, wtp) { +polygon_params <- function(graph_params) { + + wtp <- graph_params$wtp_value x_max <- graph_params$xlim[2] y_min <- graph_params$ylim[1] diff --git a/R/ceplane_ggplot_params.R b/R/ceplane_ggplot_params.R index 6ab5bd80..d539e57a 100644 --- a/R/ceplane_ggplot_params.R +++ b/R/ceplane_ggplot_params.R @@ -13,11 +13,11 @@ ceplane_ggplot_params <- function(he, pos_legend, graph_params, ...) { - + ext_params <- ceplane_geom_params(...) graph_params$area <- - modifyList(polygon_params(graph_params, wtp), + modifyList(polygon_params(graph_params), graph_params$area) graph_params$legend <- make_legend_ggplot(he, pos_legend) diff --git a/R/ceplane_plot_graph.R b/R/ceplane_plot_graph.R index ca3bf676..c8f8071a 100644 --- a/R/ceplane_plot_graph.R +++ b/R/ceplane_plot_graph.R @@ -140,6 +140,7 @@ ceplane_plot_base <- function(he, ...) { ceplane_plot_ggplot.bcea <- function(he, pos_legend, graph_params, ...) { + browser() # single long format for ggplot data delta_ce <- merge( diff --git a/R/prep_ceplane_params.R b/R/prep_ceplane_params.R index dd5f6829..ffdfc7c6 100644 --- a/R/prep_ceplane_params.R +++ b/R/prep_ceplane_params.R @@ -14,7 +14,7 @@ #' @keywords internal #' prep_ceplane_params <- function(he, wtp_params, ...) { - + browser() graph_params <- list(...) # back compatibility @@ -35,7 +35,7 @@ prep_ceplane_params <- function(he, wtp_params, ...) { ifelse(he$n_comparisons == 1, #he$change_comp, yes = intervs_in_title, no = "")) - browser() + axes_lim <- xy_params(he, wtp_params$value, graph_params) default_params <- diff --git a/cran-comments.md b/cran-comments.md index 39b96e6e..be5b6fc1 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## R CMD check results -0 errors | 0 warnings | 0 note +0 errors | 0 warnings | 0 notes * This is an updated release. From 8a7d01f792ceab360cb62155961a028621966b42 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Fri, 23 Feb 2024 09:18:00 +0000 Subject: [PATCH 4/6] updated documentation with new `wtp` argument for ggplot2 ceplane.plot() --- NEWS.md | 4 ++++ R/ceplane.plot.R | 13 +++++++++---- R/ceplane_plot_graph.R | 1 - R/prep_ceplane_params.R | 2 +- man/ceplane.plot.Rd | 12 +++++++++--- man/ceplane_ggplot_params.Rd | 4 +--- man/ceplane_plot_graph.Rd | 2 +- man/prep_ceplane_params.Rd | 4 ++-- vignettes/ceplane.Rmd | 34 ++++++++++++++++++++++++++++++++++ 9 files changed, 61 insertions(+), 15 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1f7c537d..f1f3b137 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ +# BCEA 2.4.6 (dev) + +* In `ceplane.plot()` for `{ggplot2}` version used the ggplot syntax thats already used for other plotting arguments so that we can now pass e.g. `wtp = list(value = 20000, colour = "blue", x = 10, y = 10, size = 4)`. This closes issue #151 so can do something like `wtp = list(size = 0)` to hide the willingness to pay text. (3d8a770) + # BCEA 2.4.6 _February 2024_ diff --git a/R/ceplane.plot.R b/R/ceplane.plot.R index 70e8989a..bf62d65b 100644 --- a/R/ceplane.plot.R +++ b/R/ceplane.plot.R @@ -7,7 +7,8 @@ #' comparisons together. Any subset of the possible comparisons can be selected #' (e.g., `comparison = c(1,3)` or `comparison = 2`). #' @param wtp The value of the willingness to pay parameter. Not used if -#' `graph = "base"` for multiple comparisons. +#' `graph = "base"` for multiple comparisons. For \pkg{ggplot2} can also provide +#' a list of arguments for more options (see below). #' @param pos Parameter to set the position of the legend; for a single #' comparison plot, the ICER legend position. Can be given in form of a string #' `(bottom|top)(right|left)` for base graphics and @@ -36,12 +37,17 @@ #' Should be of length 1 or equal to the number of comparisons. #' \item `icer = list(color)`: a vector of colours specifying the colour(s) of the ICER #' points. Should be of length 1 or equal to the number of comparisons. -#' \item `icer = list(size)`: a vector of colours specifying the size(s) of the ICER +#' \item `icer = list(size)`: a vector of values specifying the size(s) of the ICER #' points. Should be of length 1 or equal to the number of comparisons. #' \item `area_include`: logical, include or exclude the cost-effectiveness -#' acceptability area (default is TRUE). +#' acceptability area (default is `TRUE`). +#' \item `wtp = list(value)`: equivalent to simply using `wtp = value` but for when multiple +#' arguments are passed in list form. #' \item `area = list(color)`: a colour specifying the colour of the cost-effectiveness #' acceptability area. +#' \item `wtp = list(color)`: a colour specifying the colour of the willingness-to-pay text +#' \item `wtp = list(size)`: a value specifying the size of the willingness-to-pay text +#' \item `wtp = list(x=..., y=...)`: a value specifying the x and y coordinates of the willingness-to-pay text #' \item `currency`: Currency prefix to cost differential values - \pkg{ggplot2} only. #' \item `icer_annot`: Annotate each ICER point with text label - \pkg{ggplot2} only. #' } @@ -103,7 +109,6 @@ ceplane.plot.bcea <- function(he, pos = c(0, 1), graph = c("base", "ggplot2", "plotly"), ...) { - browser() graph <- match.arg(graph) he <- setComparisons(he, comparison) diff --git a/R/ceplane_plot_graph.R b/R/ceplane_plot_graph.R index c8f8071a..ca3bf676 100644 --- a/R/ceplane_plot_graph.R +++ b/R/ceplane_plot_graph.R @@ -140,7 +140,6 @@ ceplane_plot_base <- function(he, ...) { ceplane_plot_ggplot.bcea <- function(he, pos_legend, graph_params, ...) { - browser() # single long format for ggplot data delta_ce <- merge( diff --git a/R/prep_ceplane_params.R b/R/prep_ceplane_params.R index ffdfc7c6..aec58910 100644 --- a/R/prep_ceplane_params.R +++ b/R/prep_ceplane_params.R @@ -14,7 +14,7 @@ #' @keywords internal #' prep_ceplane_params <- function(he, wtp_params, ...) { - browser() + graph_params <- list(...) # back compatibility diff --git a/man/ceplane.plot.Rd b/man/ceplane.plot.Rd index 8db3a13c..0accf6b1 100644 --- a/man/ceplane.plot.Rd +++ b/man/ceplane.plot.Rd @@ -26,7 +26,8 @@ comparisons together. Any subset of the possible comparisons can be selected (e.g., \code{comparison = c(1,3)} or \code{comparison = 2}).} \item{wtp}{The value of the willingness to pay parameter. Not used if -\code{graph = "base"} for multiple comparisons.} +\code{graph = "base"} for multiple comparisons. For \pkg{ggplot2} can also provide +a list of arguments for more options (see below).} \item{pos}{Parameter to set the position of the legend; for a single comparison plot, the ICER legend position. Can be given in form of a string @@ -58,12 +59,17 @@ Should be of length 1 or equal to the number of comparisons. Should be of length 1 or equal to the number of comparisons. \item \code{icer = list(color)}: a vector of colours specifying the colour(s) of the ICER points. Should be of length 1 or equal to the number of comparisons. -\item \code{icer = list(size)}: a vector of colours specifying the size(s) of the ICER +\item \code{icer = list(size)}: a vector of values specifying the size(s) of the ICER points. Should be of length 1 or equal to the number of comparisons. \item \code{area_include}: logical, include or exclude the cost-effectiveness -acceptability area (default is TRUE). +acceptability area (default is \code{TRUE}). +\item \code{wtp = list(value)}: equivalent to simply using \code{wtp = value} but for when multiple +arguments are passed in list form. \item \code{area = list(color)}: a colour specifying the colour of the cost-effectiveness acceptability area. +\item \code{wtp = list(color)}: a colour specifying the colour of the willingness-to-pay text +\item \code{wtp = list(size)}: a value specifying the size of the willingness-to-pay text +\item \code{wtp = list(x=..., y=...)}: a value specifying the x and y coordinates of the willingness-to-pay text \item \code{currency}: Currency prefix to cost differential values - \pkg{ggplot2} only. \item \code{icer_annot}: Annotate each ICER point with text label - \pkg{ggplot2} only. }} diff --git a/man/ceplane_ggplot_params.Rd b/man/ceplane_ggplot_params.Rd index 712807cf..0aa3cd57 100644 --- a/man/ceplane_ggplot_params.Rd +++ b/man/ceplane_ggplot_params.Rd @@ -4,14 +4,12 @@ \alias{ceplane_ggplot_params} \title{CE-plane ggplot Parameters} \usage{ -ceplane_ggplot_params(he, wtp, pos_legend, graph_params, ...) +ceplane_ggplot_params(he, pos_legend, graph_params, ...) } \arguments{ \item{he}{A \code{bcea} object containing the results of the Bayesian modelling and the economic evaluation.} -\item{wtp}{Willingness to pay} - \item{pos_legend}{Position of legend} \item{graph_params}{Other graphical parameters} diff --git a/man/ceplane_plot_graph.Rd b/man/ceplane_plot_graph.Rd index 9c8026cf..21d68f22 100644 --- a/man/ceplane_plot_graph.Rd +++ b/man/ceplane_plot_graph.Rd @@ -14,7 +14,7 @@ ceplane_plot_base(he, ...) -\method{ceplane_plot_ggplot}{bcea}(he, wtp = 25000, pos_legend, graph_params, ...) +\method{ceplane_plot_ggplot}{bcea}(he, pos_legend, graph_params, ...) ceplane_plot_ggplot(he, ...) diff --git a/man/prep_ceplane_params.Rd b/man/prep_ceplane_params.Rd index 97f30827..151ed979 100644 --- a/man/prep_ceplane_params.Rd +++ b/man/prep_ceplane_params.Rd @@ -4,13 +4,13 @@ \alias{prep_ceplane_params} \title{Prepare CE-plane Parameters} \usage{ -prep_ceplane_params(he, wtp, ...) +prep_ceplane_params(he, wtp_params, ...) } \arguments{ \item{he}{A \code{bcea} object containing the results of the Bayesian modelling and the economic evaluation.} -\item{wtp}{Willingness-to-pay} +\item{wtp_params}{Willingness-to-pay threshold. This can be a single value or a list.} \item{...}{Additional arguments} } diff --git a/vignettes/ceplane.Rmd b/vignettes/ceplane.Rmd index 2d361bd4..55f4d78b 100644 --- a/vignettes/ceplane.Rmd +++ b/vignettes/ceplane.Rmd @@ -111,6 +111,40 @@ ceplane.plot(he, pos = c(1, 0)) ceplane.plot(he, pos = c(1, 1)) ``` +### Willingness-to-pay + +For `{ggplot2}` + +```{r} +ceplane.plot(he, graph = "ggplot2") # default +ceplane.plot(he, graph = "ggplot2", wtp = 10000) +ceplane.plot(he, graph = "ggplot2", wtp = list(value = 10000)) +ceplane.plot(he, graph = "ggplot2", wtp = list(value = 10000, colour = "blue")) +ceplane.plot(he, graph = "ggplot2", wtp = list(colour = "blue")) +ceplane.plot(he, graph = "ggplot2", wtp = list(y = 8)) +ceplane.plot(he, graph = "ggplot2", wtp = list(size = 5)) + +# to hide text +ceplane.plot(he, graph = "ggplot2", wtp = list(size = 0)) +``` + +For base `R` + +```{r} +ceplane.plot(he) # default + +##TODO: not yet implemented +# ceplane.plot(he, wtp = 10000) +# ceplane.plot(he, wtp = list(value = 10000)) +# ceplane.plot(he, wtp = list(value = 10000, colour = "blue")) +# ceplane.plot(he, wtp = list(colour = "blue")) +# ceplane.plot(he, wtp = list(y = 8)) +# ceplane.plot(he, wtp = list(size = 5)) +# +# # to hide text +# ceplane.plot(he, wtp = list(size = 0)) +``` + From 4ee271105da7e542a5a8f436a5cd5266cc8a2cde Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Fri, 23 Feb 2024 11:06:28 +0000 Subject: [PATCH 5/6] premerge --- BCEA.Rproj | 2 +- R/prep_ceplane_params.R | 4 +- man/ceplane_ggplot_params.Rd | 24 ------- man/ceplane_plot_graph.Rd | 126 ----------------------------------- man/prep_ceplane_params.Rd | 24 ------- vignettes/ceplane.Rmd | 23 +++++++ 6 files changed, 26 insertions(+), 177 deletions(-) delete mode 100644 man/ceplane_ggplot_params.Rd delete mode 100644 man/ceplane_plot_graph.Rd delete mode 100644 man/prep_ceplane_params.Rd diff --git a/BCEA.Rproj b/BCEA.Rproj index 6843888d..9f964990 100644 --- a/BCEA.Rproj +++ b/BCEA.Rproj @@ -15,4 +15,4 @@ LaTeX: pdfLaTeX BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace,vignette +PackageRoxygenize: rd,collate,namespace diff --git a/R/prep_ceplane_params.R b/R/prep_ceplane_params.R index dd5f6829..ebf8c066 100644 --- a/R/prep_ceplane_params.R +++ b/R/prep_ceplane_params.R @@ -5,7 +5,7 @@ #' parameters with defaults. #' #' @template args-he -#' @param wtp_params Willingness-to-pay threshold. This can be a single value or a list. +#' @param wtp_params Willingness-to-pay parameters. This can be a single value or a list. #' @param ... Additional arguments #' @importFrom grDevices grey.colors #' @@ -35,7 +35,7 @@ prep_ceplane_params <- function(he, wtp_params, ...) { ifelse(he$n_comparisons == 1, #he$change_comp, yes = intervs_in_title, no = "")) - browser() + axes_lim <- xy_params(he, wtp_params$value, graph_params) default_params <- diff --git a/man/ceplane_ggplot_params.Rd b/man/ceplane_ggplot_params.Rd deleted file mode 100644 index 712807cf..00000000 --- a/man/ceplane_ggplot_params.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ceplane_ggplot_params.R -\name{ceplane_ggplot_params} -\alias{ceplane_ggplot_params} -\title{CE-plane ggplot Parameters} -\usage{ -ceplane_ggplot_params(he, wtp, pos_legend, graph_params, ...) -} -\arguments{ -\item{he}{A \code{bcea} object containing the results of the Bayesian -modelling and the economic evaluation.} - -\item{wtp}{Willingness to pay} - -\item{pos_legend}{Position of legend} - -\item{graph_params}{Other graphical parameters} - -\item{...}{Additional arguments} -} -\description{ -CE-plane ggplot Parameters -} -\keyword{internal} diff --git a/man/ceplane_plot_graph.Rd b/man/ceplane_plot_graph.Rd deleted file mode 100644 index 9c8026cf..00000000 --- a/man/ceplane_plot_graph.Rd +++ /dev/null @@ -1,126 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ceplane_plot_graph.R -\name{ceplane_plot_graph} -\alias{ceplane_plot_graph} -\alias{ceplane_plot_base.bcea} -\alias{ceplane_plot_base} -\alias{ceplane_plot_ggplot.bcea} -\alias{ceplane_plot_ggplot} -\alias{ceplane_plot_plotly.bcea} -\alias{ceplane_plot_plotly} -\title{Cost-Effectiveness Plane Plot By Graph Device} -\usage{ -\method{ceplane_plot_base}{bcea}(he, wtp = 25000, pos_legend, graph_params, ...) - -ceplane_plot_base(he, ...) - -\method{ceplane_plot_ggplot}{bcea}(he, wtp = 25000, pos_legend, graph_params, ...) - -ceplane_plot_ggplot(he, ...) - -\method{ceplane_plot_plotly}{bcea}(he, wtp = 25000, pos_legend, graph_params, ...) - -ceplane_plot_plotly(he, ...) -} -\arguments{ -\item{he}{A \code{bcea} object containing the results of the Bayesian -modelling and the economic evaluation.} - -\item{wtp}{Willingness to pay threshold; default 25,000} - -\item{pos_legend}{Legend position} - -\item{graph_params}{Graph parameters in \pkg{ggplot2} format} - -\item{...}{Additional arguments} -} -\value{ -For base R returns a plot - -For \pkg{ggplot2} returns \pkg{ggplot2} object - -For \pkg{plotly} returns a plot in the Viewer -} -\description{ -Choice of base R, \pkg{ggplot2} or \pkg{plotly}. -} -\examples{ -# single comparator -data(Vaccine, package = "BCEA") - -he <- bcea(eff, cost) -ceplane.plot(he, graph = "base") - -\dontrun{ -# need to provide all the defaults because thats what -# ceplane.plot() does - -graph_params <- list(xlab = "x-axis label", - ylab = "y-axis label", - title = "my title", - xlim = c(-0.002, 0.001), - ylim = c(-13, 5), - point = list(sizes = 1, - colors = "darkgrey"), - area = list(color = "lightgrey")) - -he$delta_e <- as.matrix(he$delta_e) -he$delta_c <- as.matrix(he$delta_c) - -BCEA::ceplane_plot_base(he, graph_params = graph_params) - -## single non-default comparator - - -## multiple comparators -data(Smoking) - -graph_params <- list(xlab = "x-axis label", - ylab = "y-axis label", - title = "my title", - xlim = c(-1, 2.5), - ylim = c(-1, 160), - point = list(sizes = 0.5, - colors = grey.colors(3, start = 0.1, end = 0.7)), - area = list(color = "lightgrey")) - -he <- bcea(eff, cost, ref = 4, Kmax = 500, interventions = treats) - -BCEA::ceplane_plot_base(he, - wtp = 200, - pos_legend = FALSE, - graph_params = graph_params) -} - - -data(Vaccine) -he <- bcea(eff, cost) - -ceplane.plot(he, graph = "ggplot2") -ceplane.plot(he, wtp=10000, graph = "ggplot2", - point = list(colors = "blue", sizes = 2), - area = list(col = "springgreen3")) - -data(Smoking) -he <- bcea(eff, cost, ref = 4, Kmax = 500, interventions = treats) - -ceplane.plot(he, graph = "ggplot2") - -ceplane.plot(he, - wtp = 200, - pos = "right", - ICER_size = 2, - graph = "ggplot2") - -ceplane.plot(he, - wtp = 200, - pos = TRUE, - graph = "ggplot2") - -ceplane.plot(he, - graph = "ggplot2", - wtp=200, - theme = ggplot2::theme_linedraw()) - -} -\keyword{hplot} diff --git a/man/prep_ceplane_params.Rd b/man/prep_ceplane_params.Rd deleted file mode 100644 index 97f30827..00000000 --- a/man/prep_ceplane_params.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/prep_ceplane_params.R -\name{prep_ceplane_params} -\alias{prep_ceplane_params} -\title{Prepare CE-plane Parameters} -\usage{ -prep_ceplane_params(he, wtp, ...) -} -\arguments{ -\item{he}{A \code{bcea} object containing the results of the Bayesian -modelling and the economic evaluation.} - -\item{wtp}{Willingness-to-pay} - -\item{...}{Additional arguments} -} -\value{ -List pf graph parameters -} -\description{ -In ggplot format, combine user-supplied -parameters with defaults. -} -\keyword{internal} diff --git a/vignettes/ceplane.Rmd b/vignettes/ceplane.Rmd index 2d361bd4..a7f75632 100644 --- a/vignettes/ceplane.Rmd +++ b/vignettes/ceplane.Rmd @@ -111,6 +111,29 @@ ceplane.plot(he, pos = c(1, 0)) ceplane.plot(he, pos = c(1, 1)) ``` +### Willingness-to-pay label + +For `{ggplot2}` + +```{r} +ceplane.plot(he, graph = "ggplot2") +ceplane.plot(he, graph = "ggplot2", wtp = list(value = 25000, colour = "blue")) +ceplane.plot(he, graph = "ggplot2", wtp = list(colour = "blue")) +ceplane.plot(he, graph = "ggplot2", wtp = list(value = 40000, colour = "blue")) +ceplane.plot(he, graph = "ggplot2", wtp = 40000) +``` + +For base `R` + +```{r} +ceplane.plot(he) +ceplane.plot(he, wtp = list(value = 25000, colour = "blue")) +ceplane.plot(he, wtp = list(colour = "blue")) +ceplane.plot(he, wtp = list(value = 40000, colour = "blue")) +ceplane.plot(he, wtp = 40000) +``` + + From c2ea8010d0f1e0809ca143398f1d7f83732a1ef8 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Fri, 23 Feb 2024 11:10:28 +0000 Subject: [PATCH 6/6] removed some leftover merge <<< === --- R/prep_ceplane_params.R | 4 ---- vignettes/ceplane.Rmd | 23 ----------------------- 2 files changed, 27 deletions(-) diff --git a/R/prep_ceplane_params.R b/R/prep_ceplane_params.R index 661ed4b0..ebf8c066 100644 --- a/R/prep_ceplane_params.R +++ b/R/prep_ceplane_params.R @@ -35,11 +35,7 @@ prep_ceplane_params <- function(he, wtp_params, ...) { ifelse(he$n_comparisons == 1, #he$change_comp, yes = intervs_in_title, no = "")) -<<<<<<< HEAD -======= - ->>>>>>> 8a7d01f792ceab360cb62155961a028621966b42 axes_lim <- xy_params(he, wtp_params$value, graph_params) default_params <- diff --git a/vignettes/ceplane.Rmd b/vignettes/ceplane.Rmd index bf437ed5..f58bf761 100644 --- a/vignettes/ceplane.Rmd +++ b/vignettes/ceplane.Rmd @@ -111,22 +111,11 @@ ceplane.plot(he, pos = c(1, 0)) ceplane.plot(he, pos = c(1, 1)) ``` -<<<<<<< HEAD ### Willingness-to-pay label -======= -### Willingness-to-pay ->>>>>>> 8a7d01f792ceab360cb62155961a028621966b42 For `{ggplot2}` ```{r} -<<<<<<< HEAD -ceplane.plot(he, graph = "ggplot2") -ceplane.plot(he, graph = "ggplot2", wtp = list(value = 25000, colour = "blue")) -ceplane.plot(he, graph = "ggplot2", wtp = list(colour = "blue")) -ceplane.plot(he, graph = "ggplot2", wtp = list(value = 40000, colour = "blue")) -ceplane.plot(he, graph = "ggplot2", wtp = 40000) -======= ceplane.plot(he, graph = "ggplot2") # default ceplane.plot(he, graph = "ggplot2", wtp = 10000) ceplane.plot(he, graph = "ggplot2", wtp = list(value = 10000)) @@ -137,22 +126,11 @@ ceplane.plot(he, graph = "ggplot2", wtp = list(size = 5)) # to hide text ceplane.plot(he, graph = "ggplot2", wtp = list(size = 0)) ->>>>>>> 8a7d01f792ceab360cb62155961a028621966b42 ``` For base `R` ```{r} -<<<<<<< HEAD -ceplane.plot(he) -ceplane.plot(he, wtp = list(value = 25000, colour = "blue")) -ceplane.plot(he, wtp = list(colour = "blue")) -ceplane.plot(he, wtp = list(value = 40000, colour = "blue")) -ceplane.plot(he, wtp = 40000) -``` - - -======= ceplane.plot(he) # default ##TODO: not yet implemented @@ -167,7 +145,6 @@ ceplane.plot(he) # default # ceplane.plot(he, wtp = list(size = 0)) ``` ->>>>>>> 8a7d01f792ceab360cb62155961a028621966b42