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 }} diff --git a/CITATION.cff b/CITATION.cff index ba33420c..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 +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 + 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 1e8768bf..5fb6379c 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.1 Authors@R: person(given = c("David", "M."), family = "Phillippo", @@ -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) diff --git a/NEWS.md b/NEWS.md index c39b44b4..f8a2ee84 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# multinma 0.7.1 + +* 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 * Feature: The new `marginal_effects()` function produces marginal treatment diff --git a/R/predict.R b/R/predict.R index d6d7173c..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) %>% @@ -2054,8 +2058,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% unlist(lapply(sys.calls(), function(x) deparse(x[[1]])))) times_seq <- 50 # Other checks (including times, aux) in predict.stan_nma() diff --git a/README.md b/README.md index b5ac1346..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, 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: diff --git a/cran-comments.md b/cran-comments.md index e726c30b..7424db2c 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,12 @@ -This release adds new features and fixes a few bugs. +Require StanHeaders version 2.32.9 or later in LinkingTo, as requested, which +fixes the UBSAN warnings. + +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)