Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main CRAN submission #68

Merged
merged 41 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f99e057
Merge pull request #145 from n8thangreen/dev
n8thangreen Nov 10, 2023
7d6992f
update NEWS
n8thangreen Feb 16, 2024
3d8a770
generalised input argument to ceplane.plot for wtp label for ggplot
n8thangreen Feb 22, 2024
d4467e6
fixed bug with wtp in polygon_params()
n8thangreen Feb 22, 2024
8a7d01f
updated documentation with new `wtp` argument for ggplot2 ceplane.plot()
n8thangreen Feb 23, 2024
4ee2711
premerge
n8thangreen Feb 23, 2024
03e9d92
merged
n8thangreen Feb 23, 2024
c2ea801
removed some leftover merge <<< ===
n8thangreen Feb 23, 2024
f77594b
Merge pull request #62 from n8thangreen/dev
giabaio Feb 23, 2024
0329f8e
Fix some partial matching
giabaio Mar 27, 2024
79298dc
remove plotting of underlying CEAC in CEAF plot
n8thangreen Dec 13, 2024
44c8968
Merge branch 'dev' of https://github.com/n8thangreen/BCEA into dev
n8thangreen Dec 13, 2024
e137b8e
projectid
n8thangreen Dec 17, 2024
8aa3ca2
Merge branch 'dev' of https://github.com/n8thangreen/BCEA into dev
n8thangreen Dec 17, 2024
85ba87f
extended ggplot legend to take a vertical or horizontal part to the p…
n8thangreen Dec 20, 2024
82a8943
fixed bug with legend_pos being over-written
n8thangreen Dec 20, 2024
c0e3f4a
update Roxygen
n8thangreen Dec 20, 2024
6a2e2ce
drafted the relative size argument for ceplane
n8thangreen Dec 23, 2024
8d1586f
font resizing added to ceplane and ceac plot
n8thangreen Dec 23, 2024
84aaa2f
evi_plot ggplot size argument added
n8thangreen Dec 26, 2024
1e32788
added text size ggplot argument to eib plot
n8thangreen Dec 26, 2024
852f31a
rebuild documentation
n8thangreen Dec 26, 2024
92e9eb0
`label.pos` argument fixed in ceplane.plot got 'ggplot'
n8thangreen Dec 30, 2024
c7351e4
Added `label.pos` to base R version of ceplane.plot
n8thangreen Dec 30, 2024
82a8208
Update NEWS.md
n8thangreen Dec 30, 2024
ec2da9d
Merge pull request #160 from n8thangreen/n8thangreen-patch-2
n8thangreen Dec 30, 2024
9cc6b92
update ggplot2 syntax to
n8thangreen Jan 2, 2025
cf1937e
Merge branch 'dev' of https://github.com/n8thangreen/BCEA into dev
n8thangreen Jan 2, 2025
ad3ce21
fix small check warnings
n8thangreen Jan 2, 2025
8db0ad6
update .Rd files
n8thangreen Jan 2, 2025
656aed5
remove inla repo code in README
n8thangreen Jan 2, 2025
46cd2ba
stop tracking doc/
n8thangreen Jan 2, 2025
da3aa71
replaced map_lgl usage with unname(sapply(c("ggplot2", "grid"), requi…
n8thangreen Jan 2, 2025
32b9759
there's something wrong with purrr::map_lgl for macOS...
n8thangreen Jan 2, 2025
977ce87
include R Hub file
n8thangreen Jan 2, 2025
5376830
replaced purrr:keep() with Filter(f = \(val))
n8thangreen Jan 10, 2025
18d06df
comment out evppi tests to try and get masOS Actions to pass
n8thangreen Jan 10, 2025
4179e72
updated version number
n8thangreen Jan 10, 2025
7a8ced5
add trailing / to pass CRAN checks
n8thangreen Jan 10, 2025
fd85a2f
Merge pull request #161 from n8thangreen/dev
n8thangreen Jan 11, 2025
4889169
Merge branch 'main' into main
n8thangreen Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
^CONTRIBUTING\.md$
^revdep$
^CRAN-SUBMISSION$
^CITATION\.cff$
^CITATION.cff
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
.Rhistory
.RData
.Ruserdata
BCEA.Rcheck/
*.html
*.xml
*.js
*.Rproj
BCEA.Rcheck/
inst/doc
renv/
revdep/
BCEA_book.pdf - Shortcut
docs/*/
docs/
docs/**
3 changes: 2 additions & 1 deletion BCEA.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: 3d4ed2e6-cc51-4450-bdff-f9b9d46ae254

RestoreWorkspace: Default
SaveWorkspace: Default
Expand All @@ -15,4 +16,4 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
PackageRoxygenize: rd,collate,namespace
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors:
given-names: "Nathan"
orcid: https://orcid.org/0000-0003-2745-1736
title: "BCEA: Bayesian Cost-Effectiveness Analysis"
version: 2.4-5
version: 2.4.6
doi: 10.1007/978-3-319-55718-2
date-released: 2023-11-20
url: "https://gianluca.statistica.it/software/bcea/"
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: BCEA
Type: Package
Title: Bayesian Cost Effectiveness Analysis
Version: 2.4.6
Version: 2.4.7
Authors@R: c(
person("Gianluca", "Baio",
email = "[email protected]",
Expand All @@ -22,7 +22,7 @@ Authors@R: c(
Imports:
cli (>= 3.3.0),
dplyr,
ggplot2 (>= 3.4.0),
ggplot2 (>= 3.5.0),
graphics,
gridExtra,
MASS,
Expand All @@ -33,7 +33,7 @@ Imports:
reshape2,
rlang,
rstan,
scales,
scales
Depends:
R (>= 3.5.0)
Suggests:
Expand Down Expand Up @@ -63,11 +63,11 @@ Description: Produces an economic evaluation of a sample of suitable variables o
License: GPL-3
URL: https://gianluca.statistica.it/software/bcea/,
https://gianluca.statistica.it/,
https://github.com/giabaio/BCEA/
https://github.com/giabaio/BCEA/,
https://n8thangreen.github.io/BCEA/
NeedsCompilation: no
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Encoding: UTF-8
BugReports: https://github.com/n8thangreen/BCEA/issues/
LazyData: false
Roxygen: list(markdown = TRUE)

1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ importFrom(purrr,keep)
importFrom(purrr,list_cbind)
importFrom(purrr,map)
importFrom(purrr,map_int)
importFrom(purrr,map_lgl)
importFrom(purrr,pluck)
importFrom(reshape2,melt)
importFrom(rlang,.data)
Expand Down
21 changes: 18 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@

# BCEA 2.4.7 (dev)

# BCEA 2.4.7

_January 2025_

* 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)
* Small features added which were missing for the new edition of the BCEA book:
- Extended `ggplot` version legend to take a vertical or horizontal part to the `pos` argument (85ba87f)
- Relative font size argument `rel` for ceplane and ceac plot (8d1586f)
- Added text size `ggplot` argument to `eib_plot` (1e32788) and `evi_plot` (84aaa2f)
- `label.pos` logical argument fixed in `ceplane.plot` for `ggplot` (92e9eb0) and base `R` (c7351e4)


# BCEA 2.4.6

_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)
Expand All @@ -13,11 +28,11 @@ Patch fixing small bugs from last CRAN release.

_November 2023_

Some cosmetic changes to clean up
Some cosmetic changes to clean up.

* Removed the (by now, unnecessary) appveyor webhook
* Added correct 'Remotes' in the 'DESCRIPTION' file to point to the correct GitHub repos for 'voi' and 'plotrix'
* Changed the class of the object 'smoking_output' to be used in the 'evppi' example avoiding the need for 'rjags'
* Added correct `Remotes` in the `DESCRIPTION` file to point to the correct GitHub repos for `voi` and `plotrix`
* Changed the class of the object `smoking_output` to be used in the `evppi` example avoiding the need for `rjags`

_October 2023_

Expand Down
4 changes: 2 additions & 2 deletions R/CEriskav_plot_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CEriskav_plot_ggplot <- function(he, pos_legend) {
legend.direction = legend_params$legend_direction,
legend.title = element_blank(),
legend.background = element_blank(),
legend.text.align = 0,
legend.text = element_text(hjust = 0),
plot.title = element_text(
lineheight = 1.05,
face = "bold",
Expand Down Expand Up @@ -146,7 +146,7 @@ CEriskav_plot_ggplot <- function(he, pos_legend) {
legend.direction = legend_params$legend.direction,
legend.title = element_blank(),
legend.background = element_blank(),
legend.text.align = 0,
legend.text = element_text(hjust = 0),
plot.title = element_text(
lineheight = 1.05,
face = "bold",
Expand Down
8 changes: 7 additions & 1 deletion R/ceac_plot_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ ceac_plot_ggplot.bcea <- function(he,
#' @rdname ceac_plot_graph
#' @param ceac ceac index in `he`
#' @importFrom scales label_dollar
#' @importFrom purrr keep
#' @import ggplot2
#' @keywords internal hplot
#' @md
ceac_ggplot <- function(he,
Expand All @@ -132,7 +134,7 @@ ceac_ggplot <- function(he,

graph_params <- helper_ggplot_params(he, graph_params)
legend_params <- make_legend_ggplot(he, pos_legend)
theme_add <- purrr::keep(extra_params, is.theme)
theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_params)

ggplot(data_psa, aes(x = .data$k, y = .data$ceac)) +
geom_line(aes(linetype = .data$comparison,
Expand All @@ -145,6 +147,10 @@ ceac_ggplot <- function(he,
labels = scales::label_dollar(prefix = graph_params$currency)) +
do.call(labs, graph_params$annot) + # text
do.call(theme, legend_params) + # legend
do.call(theme, list(
axis.text = element_text(size = graph_params$text$size),
axis.title.x = element_text(size = graph_params$text$size),
axis.title.y = element_text(size = graph_params$text$size))) + # text size
scale_linetype_manual("", # lines
labels = graph_params$labels,
values = graph_params$line$type) +
Expand Down
10 changes: 5 additions & 5 deletions R/ceaf.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ ceaf.plot.pairwise <- function(mce,
xlab = "Willingness to pay",
ylab = "Probability of most cost effectiveness",
main = "Cost-effectiveness acceptability frontier")
matplot(x = mce$k,
mce$p_best_interv,
type = "l",
lty = 3,
add = TRUE)
# matplot(x = mce$k, # underlying ceac curves
# mce$p_best_interv,
# type = "l",
# lty = 3,
# add = TRUE)
lines(x = mce$k,
y = mce$ceaf,
type = "l",
Expand Down
5 changes: 2 additions & 3 deletions R/ceef_plot_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ ceef_plot_ggplot <- function(he,

extra_args <- list(...)

opt_theme <- purrr::keep(extra_args, is.theme)

opt_theme <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_args)
ceplane <- ggplot(ceef.points, aes(x = .data$x, y = .data$y))

if (add_dominance_region) {
Expand Down Expand Up @@ -111,7 +110,7 @@ ceef_plot_ggplot <- function(he,
legend.spacing = grid::unit(-1.25, "line"),
panel.grid = element_blank(),
legend.key = element_blank(),
legend.text.align = 0,
legend.text = element_text(hjust = 0),
plot.title = element_text(
hjust = 0.5,
face = "bold",
Expand Down
14 changes: 9 additions & 5 deletions R/ceplane.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
#' }
Expand Down Expand Up @@ -103,7 +109,6 @@ ceplane.plot.bcea <- function(he,
pos = c(0, 1),
graph = c("base", "ggplot2", "plotly"),
...) {

graph <- match.arg(graph)

he <- setComparisons(he, comparison)
Expand All @@ -120,7 +125,6 @@ ceplane.plot.bcea <- function(he,
} else if (is_ggplot(graph)) {

ceplane_plot_ggplot(he,
wtp,
pos_legend = pos,
graph_params, ...)

Expand Down
2 changes: 1 addition & 1 deletion R/ceplane_base_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 6 additions & 2 deletions R/ceplane_base_params_xxx.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -51,7 +53,9 @@ points_params <- function(graph_params) {
k_text <- function(graph_params, wtp) {

x_k <- graph_params$xlim[1]
y_k <- max(x_k*wtp, graph_params$ylim[1])
y_k <- ifelse(graph_params$label.pos,
max(x_k*wtp, graph_params$ylim[1]),
graph_params$ylim[1])

x_adj <- diff(graph_params$xlim)*0.04
y_adj <- diff(graph_params$ylim)*0.04
Expand Down
Loading
Loading