From d66352760b67be7bf8a32604c6a40f207fdc1a4e Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Tue, 7 May 2024 16:53:39 +0100 Subject: [PATCH 01/10] Prepare next dev version --- CITATION.cff | 4 ++-- DESCRIPTION | 2 +- NEWS.md | 2 ++ README.md | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index ba33420c..c3f1c1bd 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "multinma" in publications use:' type: software license: GPL-3.0-only title: 'multinma: Bayesian Network Meta-Analysis of Individual and Aggregate Data' -version: 0.7.0 +version: 0.7.0.9000 doi: 10.5281/zenodo.3904454 abstract: Network meta-analysis and network meta-regression models for aggregate data, individual patient data, and mixtures of both individual and aggregate data using @@ -28,7 +28,7 @@ preferred-citation: email: david.phillippo@bristol.ac.uk orcid: https://orcid.org/0000-0003-2672-7841 year: '2023' - notes: R package version 0.7.0 + notes: R package version 0.7.0.9000 url: https://dmphillippo.github.io/multinma/ doi: 10.5281/zenodo.3904454 repository: https://CRAN.R-project.org/package=multinma diff --git a/DESCRIPTION b/DESCRIPTION index 1e8768bf..ffa5f080 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: multinma Title: Bayesian Network Meta-Analysis of Individual and Aggregate Data -Version: 0.7.0 +Version: 0.7.0.9000 Authors@R: person(given = c("David", "M."), family = "Phillippo", diff --git a/NEWS.md b/NEWS.md index c39b44b4..58c04cef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# multinma 0.7.0.9000 + # multinma 0.7.0 * Feature: The new `marginal_effects()` function produces marginal treatment diff --git a/README.md b/README.md index b5ac1346..3e14f457 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ papers: The `multinma` package can be cited as follows: > Phillippo, D. M. (2024). *multinma: Bayesian Network Meta-Analysis of -> Individual and Aggregate Data*. R package version 0.7.0, doi: +> Individual and Aggregate Data*. R package version 0.7.0.9000, doi: > [10.5281/zenodo.3904454](https://doi.org/10.5281/zenodo.3904454). When fitting ML-NMR models, please cite the methods paper: From 85acbbaf6e9307dce4d5d4e83094bc2858dc9216 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Thu, 30 May 2024 16:13:41 +0100 Subject: [PATCH 02/10] Update cran comments --- cran-comments.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index e726c30b..4cb42713 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,14 @@ -This release adds new features and fixes a few bugs. +Incremented the version number and resubmitted. + +Package previously archived due to UBSAN warnings. StanHeaders 2.32.7 and 2.32.8 +omitted the necessary patch, which has been reinstated with 2.32.9. + +Confirmed that this fixes the sanitizer warnings with rocker/r-devel-san. No +changes are required to this package, this submission is identical to the +previous release (v0.7.0). ## Test environments +* rocker/r-devel-san * local R installation (Windows 10), R 4.4.0 * win-builder (release, devel) * Ubuntu 22.04.4 on GitHub Actions (release, devel, oldrel) From b43640370aa4dc50c78676c1683e1a6c1ace2279 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Thu, 30 May 2024 16:20:59 +0100 Subject: [PATCH 03/10] Version 0.7.1 --- CITATION.cff | 4 ++-- DESCRIPTION | 2 +- NEWS.md | 5 ++++- README.md | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index c3f1c1bd..0b9ee3ec 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "multinma" in publications use:' type: software license: GPL-3.0-only title: 'multinma: Bayesian Network Meta-Analysis of Individual and Aggregate Data' -version: 0.7.0.9000 +version: 0.7.1 doi: 10.5281/zenodo.3904454 abstract: Network meta-analysis and network meta-regression models for aggregate data, individual patient data, and mixtures of both individual and aggregate data using @@ -28,7 +28,7 @@ preferred-citation: email: david.phillippo@bristol.ac.uk orcid: https://orcid.org/0000-0003-2672-7841 year: '2023' - notes: R package version 0.7.0.9000 + notes: R package version 0.7.1 url: https://dmphillippo.github.io/multinma/ doi: 10.5281/zenodo.3904454 repository: https://CRAN.R-project.org/package=multinma diff --git a/DESCRIPTION b/DESCRIPTION index ffa5f080..238de1e3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: multinma Title: Bayesian Network Meta-Analysis of Individual and Aggregate Data -Version: 0.7.0.9000 +Version: 0.7.1 Authors@R: person(given = c("David", "M."), family = "Phillippo", diff --git a/NEWS.md b/NEWS.md index 58c04cef..bbe3fc1b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ -# multinma 0.7.0.9000 +# multinma 0.7.1 + +No changes. Re-release on CRAN after sanitizer warnings addressed by StanHeaders +(stan-dev/rstan#1111). # multinma 0.7.0 diff --git a/README.md b/README.md index 3e14f457..1620ca40 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ papers: The `multinma` package can be cited as follows: > Phillippo, D. M. (2024). *multinma: Bayesian Network Meta-Analysis of -> Individual and Aggregate Data*. R package version 0.7.0.9000, doi: +> Individual and Aggregate Data*. R package version 0.7.1, doi: > [10.5281/zenodo.3904454](https://doi.org/10.5281/zenodo.3904454). When fitting ML-NMR models, please cite the methods paper: From 98b1317f6ed728619cb72ad75211613af0934473 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Fri, 31 May 2024 11:24:18 +0100 Subject: [PATCH 04/10] Fix survival predict() detection of plot() calls Caused errors when called outside plot() - not enough calls in stack --- R/predict.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/predict.R b/R/predict.R index d6d7173c..37a19107 100644 --- a/R/predict.R +++ b/R/predict.R @@ -2054,8 +2054,7 @@ predict.stan_nma_surv <- function(object, times = NULL, # Set times_seq by default if called within plot() if (is.null(times_seq) && type %in% c("survival", "hazard", "cumhaz") && - (deparse(sys.call(-2)[[1]]) == "plot" || - deparse(sys.call(-3)[[1]]) == "marginal_effects" && deparse(sys.call(-4)[[1]]) == "plot")) + "plot" %in% purrr::map_chr(sys.calls(), ~deparse(.[[1]]))) times_seq <- 50 # Other checks (including times, aux) in predict.stan_nma() From a82c9a765b194d7b7dc156425b4cb022c967f7bc Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Fri, 31 May 2024 14:57:52 +0100 Subject: [PATCH 05/10] Use lapply instead Pairlists deprecated by purrr. Sometimes deparse gives length > 1 results. --- R/predict.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/predict.R b/R/predict.R index 37a19107..9db83468 100644 --- a/R/predict.R +++ b/R/predict.R @@ -2054,7 +2054,7 @@ predict.stan_nma_surv <- function(object, times = NULL, # Set times_seq by default if called within plot() if (is.null(times_seq) && type %in% c("survival", "hazard", "cumhaz") && - "plot" %in% purrr::map_chr(sys.calls(), ~deparse(.[[1]]))) + "plot" %in% unlist(lapply(sys.calls(), function(x) deparse(x[[1]])))) times_seq <- 50 # Other checks (including times, aux) in predict.stan_nma() From 685ba0403aa8bb1a8da9c24f8df03a8d8519317f Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Wed, 5 Jun 2024 09:21:54 +0100 Subject: [PATCH 06/10] Add rhub check action --- .github/workflows/rhub.yaml | 95 +++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/rhub.yaml diff --git a/.github/workflows/rhub.yaml b/.github/workflows/rhub.yaml new file mode 100644 index 00000000..74ec7b05 --- /dev/null +++ b/.github/workflows/rhub.yaml @@ -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 }} From 90f260007db7890fe96b1886598c89c28b4acb2b Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Mon, 10 Jun 2024 14:58:19 +0100 Subject: [PATCH 07/10] More robust surv predict logic when looping over studies and treatments --- R/predict.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/predict.R b/R/predict.R index 9db83468..5db3354b 100644 --- a/R/predict.R +++ b/R/predict.R @@ -1663,7 +1663,9 @@ predict.stan_nma <- function(object, ..., if (packageVersion("dplyr") > "1.1.0") { pd_undups <- dplyr::filter(preddat, .data$.study == studies[s], .data$.trt == treatments[trt]) %>% dplyr::distinct(dplyr::pick(dplyr::all_of(collapse_by))) %>% - dplyr::mutate(.dup_id = 1:dplyr::n()) + dplyr::mutate(.dup_id = seq_len(dplyr::n())) + + if (nrow(pd_undups) == 0) next pd_col <- dplyr::filter(preddat, .data$.study == studies[s], .data$.trt == treatments[trt]) %>% dplyr::left_join(pd_undups, by = collapse_by) %>% @@ -1673,7 +1675,9 @@ predict.stan_nma <- function(object, ..., } else { pd_undups <- dplyr::filter(preddat, .data$.study == studies[s], .data$.trt == treatments[trt]) %>% dplyr::distinct(dplyr::across(dplyr::all_of(collapse_by))) %>% - dplyr::mutate(.dup_id = 1:dplyr::n()) + dplyr::mutate(.dup_id = seq_len(dplyr::n())) + + if (nrow(pd_undups) == 0) next pd_col <- dplyr::filter(preddat, .data$.study == studies[s], .data$.trt == treatments[trt]) %>% dplyr::left_join(pd_undups, by = collapse_by) %>% From 4de560a296bc21f7c9e1180d9ce5e5d691f4e1d8 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Mon, 10 Jun 2024 16:26:06 +0100 Subject: [PATCH 08/10] Require latest StanHeaders to avoid cran sanitizer warnings --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 238de1e3..5fb6379c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,7 +51,7 @@ LinkingTo: RcppEigen (>= 0.3.3.3.0), RcppParallel (>= 5.0.1), rstan (>= 2.26.0), - StanHeaders (>= 2.26.0) + StanHeaders (>= 2.32.9) SystemRequirements: GNU make RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) From 11a82977baa429908b649e2fe7a0b7d595f1c8f4 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Mon, 10 Jun 2024 16:37:34 +0100 Subject: [PATCH 09/10] Update news --- NEWS.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index bbe3fc1b..f8a2ee84 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,10 @@ # multinma 0.7.1 -No changes. Re-release on CRAN after sanitizer warnings addressed by StanHeaders -(stan-dev/rstan#1111). +* Fix: Producing survival/hazard/cumulative hazard predictions for survival +models with `predict()` outside of a `plot()` call no longer gives an error +(#40). +* Fix: Increased StanHeaders version requirement to version 2.32.9 or later, to +avoid CRAN sanitizer warnings (caused by stan-dev/rstan#1111). # multinma 0.7.0 From ca2ac01922dbf8839fb7005d9d6d2eeee23e05fa Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Mon, 10 Jun 2024 16:41:35 +0100 Subject: [PATCH 10/10] Update cran comments --- cran-comments.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 4cb42713..7424db2c 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,14 +1,12 @@ -Incremented the version number and resubmitted. +Require StanHeaders version 2.32.9 or later in LinkingTo, as requested, which +fixes the UBSAN warnings. -Package previously archived due to UBSAN warnings. StanHeaders 2.32.7 and 2.32.8 -omitted the necessary patch, which has been reinstated with 2.32.9. - -Confirmed that this fixes the sanitizer warnings with rocker/r-devel-san. No -changes are required to this package, this submission is identical to the -previous release (v0.7.0). +Confirmed that this fixes the sanitizer warnings with rocker/r-devel-san and +rhub clang-asan. ## Test environments * rocker/r-devel-san +* rhub clang-asan * local R installation (Windows 10), R 4.4.0 * win-builder (release, devel) * Ubuntu 22.04.4 on GitHub Actions (release, devel, oldrel)